I have a table: \"ID name c_counts f_counts \"
and I want to order all the record by sum(c_counts+f_counts) but this doesn\'t work:
sum(c_counts+f_counts)
SELECT
This is how you do it
SELECT ID,NAME, (C_COUNTS+F_COUNTS) AS SUM_COUNTS FROM TABLE ORDER BY SUM_COUNTS LIMIT 20
The SUM function will add up all rows, so the order by clause is useless, instead you will have to use the group by clause.
order by
group by