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)
 Select within Select

Author  Topic 

rdugre
Starting Member

32 Posts

Posted - 2001-03-13 : 11:09:17
I am trying to run this SQL statement:

-----
SELECT TOP 10 txtHttpReferer, Count(txtHttpReferer) AS RefererCount
FROM
(SELECT txtRemoteAddress, txtHttpReferer FROM tblStats GROUP BY
txtRemoteAddress, txtHttpReferer)
WHERE (datStat >= '03/01/2001')
GROUP BY txtHttpReferer
HAVING (txtHttpReferer <> '')
ORDER BY Count(txtHttpReferer) DESC
-----

I'm pretty sure this is not legal SQL, because it doesn't run. So, how would I accomplish the same thing in legal SQL?

I basically want to run a query off of a subquery using the same table.

Any help is greatly appreciated.

   

- Advertisement -