我想要計算具有特定SKU的商店(商店1-10)的不同數量。這裏是我的代碼:在SQL中嵌套計數
SELECT distinct COUNT(*) as total_store
FROM(
select distinct st.*
from (select st.*
from store_table st
)st
WHERE st.store between 1 and 10
AND st.sku = 10101
GROUP BY st.store
HAVING COUNT(*) >= 1
)a;
我不斷收到一個錯誤:
ORA-00979: not a GROUP BY expression 00979. 00000 - "not a GROUP BY expression"
,我不知道爲什麼它是說?