牛骨文教育服务平台(让学习变的简单)
博文笔记

sql计算总数

创建时间:2015-05-04 投稿人: 浏览次数:1020
 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
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。