Page 1 of 1

Unknown Column

Posted: Thu Jan 06, 2011 9:09 am
by mrlayance

Code: Select all

SELECT `prov`, `log` , `name` , count(*) as `count` FROM syslog WHERE `time` LIKE "Dec 20 %" AND `prov` = 'NB' AND `count` >= 20 GROUP By `prov`, `log`,`name` ORDER BY `count` DESC
I get an error says column `count` does not exist when I add the `count` >= 20?

I might be doing this wrong, but it has worked before?

Re: Unknown Column

Posted: Thu Jan 06, 2011 10:07 am
by AbraCadaver
You can't use a column alias in a where clause and this query really isn't making any sense to me.

Re: Unknown Column

Posted: Sat Jan 08, 2011 6:54 am
by DigitalMind

Code: Select all

HAVING count(*) >= 20