You need to name the table alias in your sub select.
This will fail:
SELECT Count(*)
FROM (SELECT * FROM sysobjects)
This will work:
Select Count(*)
From (Select * From sysobjects) as tbl
Just stick an "as tblName" clause regardless of whether you use it.
In the future please post Microsoft SQL Questions to the
MSSQL Forum.
Reputation Points: 1749
Solved Threads: 735
Senior Poster
Offline 3,948 posts
since Feb 2009