-
How to get the time in asc order ?
hello all,
I have a query that gives an output like below. I need the output according to the time , like it should sort by start and end time like 7AM-12PM,12PM-5PM,5PM-10PM,10PM-3AM,3AM-7AM.
Right now it is like this:-
select to_char(a.start_date,'mm/dd/yyyy hhAM') st,to_char(a.end_date,'mm/dd/yyyy hhAM')ed
from acntv.SHOWS a,intra.pbb_batch_sum b
where a.Start_date between
to_date('07242003070000','MMDDYYYYHH24MISS')
and to_date('07252003035959','MMDDYYYYHH24MISS')
and a.batch=b.batch(+)
group by to_char(a.start_date,'mm/dd/yyyy hhAM'),to_char(a.end_date,'mm/dd/yyyy hhAM')
ST ED
--------------- ---------------
07/24/2003 10PM 07/25/2003 03AM
07/24/2003 12PM 07/24/2003 05PM
07/24/2003 07AM 07/24/2003 12PM
07/25/2003 03AM 07/25/2003 07AM
07/24/2003 05PM 07/24/2003 10PM
Thanks
-
Did you try:
ORDER BY a.start_date, a.end_date ???
"The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb
-
yes, I tried , still I dont get the way I want.
Any other suggestions?
-
order by st, end
order by 1, 2
Neither of these work either?
-
-
Hi,
Group by is not required in query.
order by start_dae,end_date
will work.
P.Soni
-
Thanks a lot Psoni. It works !!
-
Third time you get the same answer (order by) is a charm!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|