I'm using PHP but that's not important. I have a variable that contains a standard array of positive int IDs. And I want to do a SELECT
query with this array against a MySQL table to find out what IDs are not already existing in the data table. My first thought was to use IN()
but then I realized that doing it that way I can only get a list of IDs
that do exist not ones that don't. Of course with a list of IDs that do exist, I could compile it into a second array and then use array_diff()
but I can't help wondering if there's another way to do it.
NOT IN
instead ofIN
.