這是我當前的查詢:SQL:COUNT()分組結果
SELECT locationname, eventid
FROM events
GROUP BY locationname
ORDER BY locationname ASC
正如你可以看到它是由LOCATIONNAME因爲有幾行用相同的LOCATIONNAME分組。
在輸出中,我只需要一個「不同」(分組)位置的列表,但在每個位置後面應該有每個位置的總量。
因此,如果在「events」中有4個locationsname與「Congress Center NYC」,則輸出應爲「Congress Center NYC(4)」。
有沒有辦法用COUNT()擴展查詢?
謝謝!