我有一個有趣的情況,我想用變量值對DISTINCT行進行計數。SQL Select Distint Count
想像這樣的一個表:
**Customer City status**
Acme Sydney Exist
Bally Sydney new exist
Bally Melbourne new exist
Costco Melbourne Exist
David Sydney null
Ego Japan Exist
Dave Sydney Exist
我在尋找這樣的結果: 組的狀態 「存在」
**City status**
Sydney 2
Japan 1
Melbourne 1
如何爲這個結果
創建SQL查詢謝謝
提示:'WHERE'和'GROUP BY'。 –
你使用的是mysql還是sql? – xsami
使用mysql,你的代碼結果單行不起作用 – ladyWomen