View Single Post
  #6 (permalink)  
Old 07-02-2007, 08:37 PM
Dimitar
 
Posts: n/a
Default ANY answer. Re: How to COUNT records in UNION?

Quote:
Originally Posted by MapGeek View Post
Incidentally, so as not to mislead anyone reading this, in my previous reply I was wrong about SELECT COUNT(*) FROM (SELECT ...). It also generates a syntax error. Maybe you just can't use the COUNT function with a subquery in any way, at least with SQL Server.
MapGeek,

Could you try aliasing the subquery:
SELECT COUNT(*) FROM (SELECT ...) as u

I am not a SQL Server user so I might be completely wrong in my guess.

Hope this helps.
Dimitar
Reply With Quote