sql计算总数
select
d.store ,count(*),f.created_date,f.plan_state,g.channel_type
from patrol_plan_result d
left JOIN patrol_plan f on d.patrol_plan=f.id
LEFT JOIN basic_crm_channel g on g.CHANNEL_NBR=f.store
where d.created_date>="2015-05-01" and f.exe_start_time>="2015-05-01"
and f.exe_end_time<="2015-05-31" and f.plan_type=1 and g.is_display=0
and g.STATUS_CD=1000 and g.CHANNEL_CLASS=10
group by d.store having count(*) <=30
d.store ,count(*),f.created_date,f.plan_state,g.channel_type
from patrol_plan_result d
left JOIN patrol_plan f on d.patrol_plan=f.id
LEFT JOIN basic_crm_channel g on g.CHANNEL_NBR=f.store
where d.created_date>="2015-05-01" and f.exe_start_time>="2015-05-01"
and f.exe_end_time<="2015-05-31" and f.plan_type=1 and g.is_display=0
and g.STATUS_CD=1000 and g.CHANNEL_CLASS=10
group by d.store having count(*) <=30
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。
- 上一篇: Servlet中HttpSession
- 下一篇: PHP几个防SQL注入攻击自带函数区别