Multiple Count Statements in a single stament on a same table in sql -
how combine these 2 queries single query ? tried various options none of them worked.
sql>
select count (*) tab_proclog_cso ( to_char(starttime, 'yyyymmddhh24miss') between('20130709000000') , ('20130709010000') ); count(*) ---------- 28328
sql>
select count (*) tab_proclog_cso ( to_char(starttime, 'yyyymmddhh24miss') between('20130709010000') , ('20130709020000') ); count(*) ---------- 14997
select sum(case when to_char(starttime, 'yyyymmddhh24miss') between('20130709000000') , ('20130709010000') 1 else 0 end) res1 ,sum(case when to_char(starttime, 'yyyymmddhh24miss') between('20130709000000') , ('20130709010000') 1 else 0 end) res2 tab_proclog_cso
Comments
Post a Comment