
The following SQL query causes an error
SELECT vote_vo_ip, COUNT(*) as times FROM `vote` LEFT OUTER JOIN `voter` ON vote.vote_vo_id = voter.vo_id WHERE vote_co_id = 2 AND times > 1 GROUP BY vote_vo_ip
The column ‘times’ has not been created when we run the WHERE clause, so we have to use HAVING after the WHERE, for example
SELECT vote_vo_ip, COUNT(*) as times FROM `vote` LEFT OUTER JOIN `voter` ON vote.vote_vo_id = voter.vo_id WHERE vote_co_id = '.$co_id.' GROUP BY vote_vo_ip HAVING times > 1
Which works
Main Category
Secondary Categories