我现在的目的就是求2015年3月的自营铺销售最大的货号
请求解决
追答select checkgoodsId, max(xiaoliang) from (
select c.checkgoodsId as checkgoodId, sum(c.quantiy) as xiaoliang
from 表1 a, 表2 b, 表3 c
where a.customer_id = b.customer_id
and b.checkId = c.checkid
and a.method = "自营"
and b.checkDate between "2015-03-01" and "2015-03-31"
group by c.checkgoogsId
) group by checkgoodsId
主要是内层sql,外层的分组也可以,排序也可以
下面怎么两个group by
本回答被提问者采纳