日期:2014-05-17 浏览次数:20722 次
SELECT COUNT(1),to_char(time,'IW'),company FROM TABLE
GROUP BY company, to_char(time,'IW')
ORDER BY to_char(time,'IW')
SELECT a.company, sum(1) zs,a.iw_start, a.iw_end
FROM (select company,trunc(time, 'd') iw_start, (trunc(time, 'd')+6) iw_end,fdate from table_name order by time) a
GROUP BY a.company,a.iw_start,a.iw_end
ORDER BY a.iw_start,a.company
SELECT a.company, sum(1) zs,a.iw_start, a.iw_end
FROM (select company,trunc(time, 'd') iw_start, (trunc(time, 'd')+6) iw_end,time from table_name order by time) a
GROUP BY a.company,a.iw_start,a.iw_end
ORDER BY a.iw_start,a.company
SELECT company, zs, min_date, max_date
FROM (select b.iw_start, min(time) min_date, max(time) max_date