tsql - T-SQL multiple order by clauses -
tsql - T-SQL multiple order by clauses -
is possible have multiple order clauses in select statement? can this?
select top(5) * [db].[dbo].[schedules] (datepart(hour, [arrival]) >= datepart(hour, getdate())) order abs( (datepart(hour, [arrival]) - datepart(hour, getdate()))*60 + datepart(minute, [arrival]) - datepart(minute, getdate())) order [arrival]
reason need sec order ensure records returned in increasing arrival times.
tia.
use comma separated list:
select top(5) * [db].[dbo].[schedules] (datepart(hour, [arrival]) >= datepart(hour, getdate())) order abs( (datepart(hour, [arrival]) - datepart(hour, getdate()))*60 + datepart(minute, [arrival]) - datepart(minute, getdate()) ), [arrival]
tsql sql-order-by
Comments
Post a Comment