我想要计算具有特定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"
,我不知道为什么它是说?