On 01/25/2011 09:47 PM, Ian Hardingham wrote: > Hey guys. > > I have the following table: > > ratingsTable (id INTEGER PRIMARY KEY AUTOINCREMENT, mtId INTEGER, user > TEXT, rating INTEGER); > > mtId links to another table's primary key > > I wish to have a query which gives me the mtId which is represented most > often in the ratingsTable. > > Does anyone have any advice?
SELECT mtId FROM ratingsTable GROUP BY mtId ORDER BY count(*) DESC LIMIT 1; _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

