select a,b from (select id as a,count(id) as b from repetitionhistory group by id) where b<3
-------- Original Message -------- Subject: select ... where count(*) Date: Sat, 23 Jun 2012 18:55:22 +0200 From: Patrik Nilsson <nipatriknils...@gmail.com> To: General Discussion of SQLite Database <sqlite-users@sqlite.org> Hi All, I want to write a statement like: (gives error on "count", misuse of aggregate: count()) select id,count(*) from repetitionhistory where count(id)<3 group by id This statement works when written without "where": select id,count(*) from repetitionhistory group by id But I'm only interested in those not being used many times. Best regards, Patrik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users