日期:2014-05-16 浏览次数:20427 次
SELECT MQ.DT_COL, SUM(DECODE(IND_COL, 'Y', 1, 0)) NUM_Y, SUM(DECODE(IND_COL, 'N', 1, 0)) NUM_N FROM ------------------------ ( select TRUNC(to_date('2009-01-01', 'yyyy-mm-dd') + level / 3, 'dd') DT_COL, decode(mod(level, 2), 0, 'Y', 'N') IND_COL, round(level*10/3,0) NUM_COL, decode(mod(level, 5), 0, 15, LEVEL) NUM_COL_HAVE_SAME, chr( mod(level-1,26 ) +65 ) TXT_COL_SMALL_CASE, chr( mod(level-1,26 ) +97 ) TXT_COL_CAPTIAL_CASE, decode(mod(level,2),0, chr( mod(level-1,26 ) +65 ),1,chr( mod(level-1,26 ) +97 )) TXT_COL_ALPHABET from dual connect by level <= 100 ) MQ ------------------------- GROUP BY MQ.DT_COL
?
?
-----level 101 == level 1 ? select to_char(level) || '-' || chr(level), to_char(level + 100) || '-' || chr(level + 100) from dual connect by level <= 100
?