Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 joining 2 tables which contains an order by

Author  Topic 

pelegk2
Aged Yak Warrior

723 Posts

Posted - 2006-01-02 : 05:46:43
i want to joing 2 select in which each one of them has its own oreder by but i recive an error!
when i remove both of the order by everything is ok - why is that?
thnaks in advance
peleg

Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:)

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-01-02 : 06:39:35
Use it as Derived table

Select * from
(
Select .........
Union All
Select .........
) T
Order by ........

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2006-01-03 : 09:38:01
If you are joining the select statements as subqueries, you cannot include and ORDER BY statement in a subquery (it is logically pointless anyway). The ORDER BY applies only to the final results set, so you will need to move the clause to your outer SELECT statement.
Go to Top of Page
   

- Advertisement -