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 2005 Forums
 Transact-SQL (2005)
 Nested SELECT STATMENTS

Author  Topic 

ashraff87
Starting Member

17 Posts

Posted - 2008-07-24 : 07:44:01
I want to perform a select statment on another select statments results...

So im trying to do somthing LIKE the following in format yet it doesnt work:


SELECT * FROM (
SELECT * FROM DATATABLE
)
WHERE xyz = '4'


I know the code above would be poitless but im interested for a more complex cause.

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-07-24 : 07:45:48
you need to give your derived table an alias...

SELECT * FROM (
SELECT * FROM DATATABLE
) tableA
WHERE xyz = '4'


Em
Go to Top of Page
   

- Advertisement -