I need to sum columns and sort them highest to lowest.
This is what I've tried!
$sth = $db->prepare("SELECT sum(A), sum(S), sum(D), sum(F) FROM XXX order by A, S, D, F DESC");
$sth->execute();
$result = $sth->fetch(PDO::FETCH_ASSOC);
This is what the output looks like:
Array ( [sum(A)] => 38 [sum(S)] => 194 [sum(D)] => 40 [sum(F)] => 164 )