I have an SQLite database with 3 tables. Each of these tables have two columns: name and value such that all the tables have the same records (name) but different values. How do I select the records that are a part of least sum of values spanning across these tables such that the record names are unique?
Names: Steven, Jamie, Michael, Jordan, Gary
Values
(in the order of names)
Table 1: 1, 2, 3, 4, 5
Table 2: 2, 3, 1, 5, 6
Table 3: 9, 0, 2, 11, 3
The output should return (Steven, Michael, Jamie) because the sum of the values in this case would equal to 2 which would be the least possible.
Aucun commentaire:
Enregistrer un commentaire