`
dannyhz
  • 浏览: 371617 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
文章分类
社区版块
存档分类
最新评论

根据status来分组

 
阅读更多
引用

根据 apply_status 的值 来分类



select s.* , count(case when ob.apply_status = 7 then ob.apply_status  end) as reject_count,
 count(case when ob.apply_status > 1 and ob.apply_status < 6 then ob.apply_status  end) as inprogress_count,
 count(case when ob.apply_status > 0  then ob.apply_status  end) as total_count
 from salesman s left join order_base ob on s.salesman_id = ob.salesman_id 
 where ob.apply_status > 0
group by s.salesman_id ;

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics