hello all

i am using a query select 'hour','filename','tot_sent_count','tot_success','tot_prm_fail','tot_switchedoff','tot_other_error' UNION select hour,filename,sum(tot_sent_count),sum(tot_success),sum(tot_prm_fail),sum(tot_switchedoff),sum(tot_other_error) INTO OUTFILE '/tmp/hourlyFileMis(2011-03-09)' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n' from tbl_mis where date_format(date_time,'%Y-%m-%d')='2011-03-09' group by hour,filename order by hour; output is ok but one thing is not coming properly that header fields are coming at the last line while i want it at first line.output is as follows


11,admin.txt,2,0,0,0,0
12,spice.txt,1,1,0,0,0
12,fil-V194.txt,270954,135337,7255,45404,15387
12,admin.txt,5,3,1,0,0
13,fil-V193.txt,230031,160904,8805,40962,19453
14,fil-V191.txt,263089,146926,24669,76718,14893
15,fil-mnn6.txt,245439,169885,10239,47005,18431
16,fil-jann2.txt,260134,89141,17421,49061,8647
17,fil-jann4.txt,245439,121276,7440,34036,16174
18,fil-mnn3.txt,260134,0,0,0,0
9,spice.txt,3,0,0,0,0
hour,filename,tot_sent_count,tot_success,tot_prm_fail,tot_switchedoff,tot_other_error


i want last line to be at first Line.

Try order by 0 + hour

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.