1
Answer

Get order by from two columns based on time

Smile

Smile

5y
638
1
 Hi
I am having a table with two columns that is Arrival and departure times i need to get the out put based on time from two columns  in ascending order 
   
 
ArrivalDept Table
Pkey  Fkey_Sno   Arrival    Departure 
 
1          1                  00:00      12  :00
2           2                 10:40       11:10
3            3                11:05       11:15 
4             4               00:00         11:30
 
 
need Final output as 
 
2     2     10:40     11:10
4    4       00:00     11:12 
3     3     11:05     11:15
1     1     00:00     12 :00 
 
 Select Pkey ,ArrivingTime,DepartureTime from table1  where Arrival between '11' and '13' or Departure  between '11' and '13' order by Arrival  it gives out put as
 
 1        1       00:00        12 :00
4         4       00:00        11:12 
2        2        10:40        11:10
3        3        11:05        11:15
 Any suggestions will be helpful
 
Answers (1)