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
 Transact-SQL (2000)
 selecting from a select statement

Author  Topic 

sunnyjassal
Starting Member

28 Posts

Posted - 2004-05-18 : 10:38:00
Hello i would like to know how the following can be done... i know in pl sql i can do it but when i try this in t-sql it does not work

select * from (

select a, b from tablea where c = @k
union
select a, b from tablec where d = @j

)
order by a asc

Thanks in advance for your help.

Sunny Jassal

TurdSpatulaWarrior
Starting Member

36 Posts

Posted - 2004-05-18 : 10:45:05
select * from (

select a, b from tablea where c = @k
union
select a, b from tablec where d = @j

) DERIVEDTBL
order by a asc
Go to Top of Page

sunnyjassal
Starting Member

28 Posts

Posted - 2004-05-18 : 10:46:18
thank you so much i will try that out
Go to Top of Page
   

- Advertisement -