Monday, June 8, 2009

Order by doesn't work with Union sql server 2000

http://www.sqlteam.com/article/union-selecting-from-multiple-tables-in-one-statement

select col1 from tblA order by col2 desc
union
select col2 from tblB order by col2 desc

-It gives error.

Workaround is:

select col1 from tblA
union
select col2 from tblB order by col2 desc

No comments: