原因
use pubs
select stor_id ,sum(qty) as 总订货数量, count (distinct stor_id) as 客户ID from sales where stor_id=7131
为什么不行呢?
use pubs
select stor_id ,sum(qty) as 总订货数量, count (distinct stor_id) as 客户ID from sales where stor_id=7131
为什么不行呢?
group by stor_id 或者select sum(qty) as 总订货数量, count (distinct stor_id) as 客户ID from sales where stor_id=7131
group by stor_id
from sales
where stor_id='7131'
group by stor_id
from sales
where stor_id='7131'