日期:2014-05-17 浏览次数:21082 次
select count(1) from ba_purchase where date>=? and data<=? group by sp_code having count(purchase_code)>1
------解决方案--------------------
select count(distinct purchase_code)
from ba_purchase
where sp_code = 企业编号
and date between 开始日期 and 截止日期;
select count(*)
from (select *
From ba_purchase
where date between 开始日期 and 截止日期
group by sp_code, purchase_code
having count(*) > 1);