码迷,mamicode.com
首页 > 数据库 > 详细

SQL case when用法

时间:2015-03-19 21:46:01      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:

select sum(case when t.lr_date > to_date(2013-12-12,yyyy-mm-dd) and 1=1 then 1 else 0 end) date1sum,
sum(case when t.lr_date < to_date(2013-12-13,yyyy-mm-dd) and 1=1 then 1 else 0 end) date2sum,
jsxm_code from cj_main t where 1=1 group by jsxm_code

 

SQL case when用法

标签:

原文地址:http://www.cnblogs.com/xiaoshi212/p/4351770.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!