日期:2014-05-17 浏览次数:20830 次
select NVL(SUM(CASE WHEN txsj =(to_char(SYSDATE-1,'YYYY-MM-DD')) THEN 1 ELSE 0 END), 0) yesterday, --昨天 NVL(SUM(CASE WHEN txsj =(to_char(SYSDATE,'YYYY-MM-DD')) THEN 1 ELSE 0 END), 0) today, --今天 NVL(SUM(CASE WHEN txsj =(to_char(SYSDATE+1,'YYYY-MM-DD')) THEN 1 ELSE 0 END), 0) tomorrow,--明天 from BWL;
------解决方案--------------------
select * from BWL where txsj between to_char(sysdate-1,'yyyy-mm-dd') and to_char(sysdate+1,'yyyy-mm-dd')
------解决方案--------------------
3,4应该满足你需求,我就不献丑了~~