On 10/18/2014 10:30 PM, ye yanhong wrote:
  select count(scode) as bb,scode from mytb where trues=1 and bb=3 group by 
scode;

Error: misuse of aggregate: count()

You are trying to use (indirectly, via bb alias) an aggregate function in a WHERE clause. You can't. WHERE clause specifies conditions on the underlying table rows, before aggregation is performed.

If you want to only report groups containing exactly three rows, use HAVING clause.
--
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to