SELECT Trim(Store_Name)+SALES, COUNT(*)
FROM StoreInformation
GROUP BY Trim(StoreName)+SALES
HAVING COUNT(*) > 1
SELECT Store_Name, COUNT(*)
FROM Store_Information
GROUP BY Store_Name, Sales;
結果如下:
Store_Name | COUNT(*) |
---|---|
Los Angeles | 2 |
Los Angeles | 1 |
Boston | 1 |
建議將 Sales 欄位加入查詢,這樣更有辨識度。