SQL newbie here, just learning how to do some basics. Working in SQLite, If I have an array of conditions I can search for any matches using IN, like so:
SELECT * FROM people WHERE job_id IN (1,2,3)
In this contrived example, this would give me any people with job id 1, 2 or 3. However, in a different case, how could I make this an ALL condition? Ie. select people with job_id matching all terms in the array?
I think that in some dbs you can do this:
SELECT * FROM people WHERE job_id IN ALL (1,2,3)
But when I try this in SQLite I get syntax error near ALL. So, how do you do this in SQLite, and, for bonus points, is there a way to write this kind of query that would also be compatible with PostgreSQL?
behind the
GROUP BYandHAVINGis to count all the number of records match by thejob_id