不是这个原因,如果你要显示B.departname就必须把它放在group by后面,常识问题。
select A.customersid,count(*),B.departname
from order_info A
inner join depart_info B on A.customersid=B.customersid
where A.date='20060501'
group by A.customersid,B.departname
select A.customersid,count(*),B.departname
from order_info A
inner join depart_info B on A.customersid=B.customersid
where A.date='20060501'
group by A.customersid,B.departname
from order_info A
inner join depart_info B on A.customersid=B.customersid
where A.date='20060501'
group by A.customersid,B.departname
这个句子执行是成功的,请问上面的count(*)需不需要写成count(A.*)或者A.count(*)呢?
还有一个问题,假如我希望得到的结果是count(*)>=4的结果集,该怎么办?