ORDER BY 1,2,3

Posted by Tomaz.tsql on SQL Blogcasts See other posts from SQL Blogcasts or by Tomaz.tsql
Published on Tue, 07 Dec 2010 17:38:00 GMT Indexed on 2010/12/08 5:45 UTC
Read the original article Hit count: 311

Filed under:
Only for lazy people -> how to order our output by defining numbers instead of column names: select * from ( select 1 as id, 'test' as text_name, 32 as seq union all select 3 as id, 'best' as text_name, 61 as seq union all select 4 as id, 'best' as text_name, 12 as seq union all select 4 as id, 'best' as text_name, 6 as seq union all select 2 as id, 'hest' as text_name, 21 as seq ) as x order by 2,3 --order by 1,2,3 you can specify the select list or you...(read more)

© SQL Blogcasts or respective owner

Related posts about ORDER BY