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

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -