4
我想在單個查詢中計算兩列,但結果是爲medcount和uploadcount吐出相同的值。有什麼建議麼?單個查詢中的MySQL多次計數
SELECT * , COUNT($tbl_list.listname) AS listcount,
COUNT($tbl_uploads.id) AS uploadcount
FROM $tbl_members
LEFT JOIN $tbl_list ON $tbl_members.username = $tbl_list.username
LEFT JOIN $tbl_uploads ON $tbl_members.username = $tbl_uploads.username
GROUP BY $tbl_members.username
ORDER BY $tbl_members.lastname, $tbl_members.firstname;