How can I extract the count()
as an alias? I've basically got this query?
SELECT *, count(*) AS total_count
FROM `action_log`
WHERE `response` LIKE '%media%'
AND `action_time` > '2014-01-05 21:31:33'
AND `action_time` < '2014-01-07 12:30:00'
AND `total_count` > '1'
GROUP BY `username`
The error is shown as below
#1054 - Unknown column 'total_count' in 'where clause'
I understand that syntax isn't correct, I've looked through the mySQL references and I can't seem to find it anywhere?