Here is the basic fields of a table.
field 1, field 2, field 3. Field 1 is varchar, 2 and 2 are int.
Select field1, sum(field2), sum(field3) GROUP BY field1 ORDER BY ??? sum(field2)???
I am trying to put the returned results in order from the sum of field 2
ie...
field1 field 2 field3
nick 20 2
matt 10 4
jason 5 1
Another Question. Can I order by 2 sums that have been divided.
ie...
SELECT field1, sum(field2), sum(field3) FROM TABLE GROUP BY field1 ORDER BY (field2 / field3) DESC
Again with the sum of 2 fields, then divided to get an avg between the 2 sums and ordered correctly by the avg.
ie...
field 1 field2 field3 AVG
nick 20 5 4
matt 15 5 3
jason 10 5 2