我需要对列求和并将它们从高到低排序。
这是我试过的!
$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);
这是输出的样子:
Array ( [sum(A)] => 38 [sum(S)] => 194 [sum(D)] => 40 [sum(F)] => 164 )