I'm having a small SQL problem - as I often do :P
How can I just return the highest summed amount out of all columns?
+-------+------+
| TYPE | VAL | Dog sums to 6
|-------+------| Frog sums to 5
| Cat | 2 | Cat sums to 5
|-------|------|
| Dog | 3 |
|-------|------|
| Dog | 3 |
|-------|------|
| Cat | 2 |
|-------|------|
| Cat | 1 |
|-------|------|
| Frog | 5 |
+-------+------+
For instance, from the table above I just want to return -
+-------+------+
| TYPE | VAL |
|-------+------|
| Dog | 6 |
+-------+------+
How could I sum all columns, and then return the one with the highest summed value?
Thanks for your time
Aucun commentaire:
Enregistrer un commentaire