?????? 本人不喜欢在sql里面大小写混合在一起,每次看到别人的sql,总是要转换为小写,如以下sql:
???????
WITH t AS( select date'2014-05-06' time1, 1 type, 100 times from dual union allselect date'2014-05-06', 2, 200 from dual union allselect date'2014-05-06', 3, 400 from dual union allselect date'2014-05-07', 2, 50 from dual union allselect date'2013-06-01', 1, 100 from dual)SELECT time2, SUM(nvl(times, 0)) FROM (SELECT * FROM (SELECT DATE '2014-05-01' + LEVEL - 1 time2 FROM dual CONNECT BY LEVEL <= (SELECT to_char(last_day(DATE '2014-05-01'), 'dd') FROM dual)) t1 LEFT JOIN t ON t1.time2 = t.time1) GROUP BY time2 ORDER BY 1;
?? 最简单的方法是使用lower函数,运行把原sql粘贴进去就可以了,不需要额外操作:
??????
select lower(q'[&1]') from dual
??? 如下所示:
??
??
??
?
???? 全文完。