group by条件问题
select count(materialprofile.F_SN) as qty,F_SN
from temp
where
F_closetime BETWEEN '2010-06-01' AND '2011-01-01'
想加个条件是qty > 2 的显示
这个条件怎么写呀
[解决办法]
select count(materialprofile.F_SN) as qty,F_SN from tempwhere F_closetime BETWEEN '2010-06-01' AND '2011-01-01' group by F_SN having count(materialprofile.F_SN)>2
[解决办法]
select count(materialprofile.F_SN) as qty,F_SN from tempwhere F_closetime BETWEEN '2010-06-01' AND '2011-01-01' group by F_SN having count(materialprofile.F_SN)>2
[解决办法]
select count(*) as qty,F_SN from tempwhere F_closetime BETWEEN '2010-06-01' AND '2011-01-01'group by F_SNhaving count(*)>2
[解决办法]
select count(materialprofile.F_SN) as qty,F_SN from tempwhere F_closetime BETWEEN '2010-06-01' AND '2011-01-01' group by F_SN having count(1)>2