johnnyb
09-15-2006, 12:30 AM
I want to do this:
SELECT COM_idLST, COUNT(idCOMMENT) AS Comments
FROM COMMENT
GROUP BY idCOMMENT
WHERE Comments > 5
But as we know I can't use aliases in the WHERE clause. I tried putting the COUNT() function there as well but that didn't work. How can I write a query that will do what I want it to, (I think the desired result is apparent from the bad code above), but is actually possible?
Thanks in advance,
John
SELECT COM_idLST, COUNT(idCOMMENT) AS Comments
FROM COMMENT
GROUP BY idCOMMENT
WHERE Comments > 5
But as we know I can't use aliases in the WHERE clause. I tried putting the COUNT() function there as well but that didn't work. How can I write a query that will do what I want it to, (I think the desired result is apparent from the bad code above), but is actually possible?
Thanks in advance,
John