you have to use `HAVING' instead of `WHERE' like this.
COUNT(*) AS count
GROUP BY `term`
HAVING count >= 5
ORDER BY count DESC;
put `HAVING' next of `GROUP BY'.
`WHERE' behaves at before aggregate of `GROUP BY'.
your SQL means like
SELECT .. FROM (SELECT * FROM .. WHERE count >= 5) AS dummy GROUP BY ..
because of that, mysqld says `Unknown column .. in where clause'
2012/6/17 Haluk Karamete <halukkaramete@stripped>:
> Hi, I'm trying to get this work;
> SELECT distinct `term`,count(*) as count FROM
> blp_sql_distinct_temp_table where count >= 5 group by `term` order by
> count DESC
> But I get this error;
> Unknown column 'count' in 'where clause'
> How do I get only those records whose group by count is above 5?
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql