On Tue, 11 Nov 2008 07:30:21 -0500, "Igor Tandetnik" <[EMAIL PROTECTED]> wrote: >> SELECT code.number,COUNT(companies.code) FROM code,companies WHERE >> code.id=companies.code >> ======== > >Add "GROUP BY code.id"
One more thing: I'd like to only retrieve rows where code.number and COUNT(companies.code) don't match (this happens if there were a network problem or a bug on the server from which I'm downloading those data). SQLite doesn't seem to allow this: ===== SELECT code.number,COUNT(companies.code) FROM code,companies WHERE code.id=companies.code AND code.number <> COUNT(companies.code) GROUP BY code.id SQL error: misuse of aggregate: COUNT(companies.code) ===== Should I use a sub-SELECT to perform the second COUNT? Thank you. _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

