mysql - Grouping the date columns in week range -
mysql - Grouping the date columns in week range -
i have table , columns like
start_date timestamp, end_date timestamp, id number, cost number(10,2).
and info inserted table 'll this
1,'2013-02-03 00:00:00','2013-02-03 00:00:00',75*0.06 1,'2013-02-04 00:00:00','2013-02-04 00:00:00',75*0.06 1,'2013-02-05 00:00:00','2013-02-05 00:00:00',75*0.06 1,'2013-02-06 00:00:00','2013-02-06 00:00:00',75*0.06 1,'2013-02-07 00:00:00','2013-02-07 00:00:00',75*0.06 1,'2013-02-08 00:00:00','2013-02-08 00:00:00',75*0.06 1,'2013-02-09 00:00:00','2013-02-09 00:00:00',75*0.06
and want grouping columns start_date
, end_date
sunday saturday.
can please help me on this.
thanks in advance.
this best can offer question impossible understand sample provided. iso week table 2013:
select start_date -- 1/1/2013 -- , trunc(start_date, 'iw') wk_starts , trunc(start_date, 'iw') + 7 - 1/86400 wk_ends , to_number (to_char (start_date, 'iw')) iso_wk#_iw , to_char(start_date, 'day') wk_day ( select trunc(sysdate, 'year')-1 + level start_date dual connect level <= ( select trunc(add_months (sysdate, 12), 'y')-trunc(sysdate, 'y') "num of days in 2013" dual ) ) / start_date wk_starts wk_ends iso_wk# wk_day ---------------------------------------------------------------------- 1/1/2013 12/31/2012 1/6/2013 11:59:59 pm 1 tuesday 1/2/2013 12/31/2012 1/6/2013 11:59:59 pm 1 quarta-feira ..... 1/7/2013 1/7/2013 1/13/2013 11:59:59 pm 2 mon 1/8/2013 1/7/2013 1/13/2013 11:59:59 pm 2 tuesday .....
you can add together other formats date , order guess...
mysql sql oracle oracle10g netezza
Comments
Post a Comment