Order by weekno and year in Mysql -
Order by weekno and year in Mysql -
select abc.mnth mnth,sum(abc.info) info (select aaa.mnth mnth, aaa.info info ((select ontime.mnth mnth, ontime.info info (select ontimerecords.mnth mnth , round(((ontimerecords.count/completed.count)*100),2) info (select date_format(t.dtdelivery,'%v %x') mnth, count(*) count table1 t fcompleted = 1 , t.fstatus = 1 , t.dtdelivery >= '2013-01-01 00:00:00' , t.dtdelivery <= '2013-12-28 23:59:59' , find_in_set(t.sprojectcode,'all,pj1,pj2,hhfgh,tewrtert,dfgdgdf,project code,null,tyuire,dfgdfgdf,[select]') > 0 , t.dtdelivery <= t.dtdeliverydue grouping date_format(t.dtdelivery,'%v %x') order date_format(t.dtdelivery,'%v %x')) completed inner bring together (select date_format(t.dtdelivery,'%v %x') mnth, count(*) count table1 t fcompleted = 1 , t.fstatus = 1 , find_in_set(t.sprojectcode,'all,pj1,pj2,hhfgh,tewrtert,dfgdgdf,project code,null,tyuire,dfgdfgdf,[select]') > 0 , t.dtdelivery >= '2013-01-01 00:00:00' , t.dtdelivery <= '2013-12-28 23:59:59' , t.dtdelivery <= t.dtdeliverydue grouping date_format(t.dtdelivery,'%v %x') order date_format(t.dtdelivery,'%v %x')) ontimerecords on ontimerecords.mnth = completed.mnth) ontime) union (select monthdates.mnth mnth, monthdates.info info ((select distinct(date_format(adate,'%v %x')) mnth ,0 info ( select @maxdate - interval (a.a+(10*b.a)+(100*c.a)+(1000*d.a)) day adate (select 0 union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) a, /*10 day range*/ (select 0 union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) b, /*100 day range*/ (select 0 union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) c, /*1000 day range*/ (select 0 union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) d, /*10000 day range*/ (select @mindate :='2013-01-01 00:00:00', @maxdate :='2013-12-28 23:59:59') e ) f adate between @mindate , @maxdate order adate asc )) monthdates) ) aaa order aaa.mnth desc) abc grouping abc.mnth order str_to_date (abc.mnth,'%v %x');
i want generate study based on start date , end date. want weekwise report. have query result below..
week info 02 2013 0 06 2013 100 01 2013 0 05 2013 0 53 2012 0 04 2013 0 08 2013 100 03 2013 0 07 2013 100
i want result below
week info 53 2012 0 01 2013 0 02 2013 0 03 2013 0 04 2013 0 05 2013 0 06 2013 100 07 2013 100 08 2013 100
this query incredibly convoluted, , seems there order by
on every psuedo-table select statement.
i seek removing order by
s, check results, , (assuming results satisfactory) apply single order by
@ end - order abc.mnth
, seems date, , want in date order.
mysql
Comments
Post a Comment