0
I know I can check codes that are in one table and are not in another with the following query:
SELECT cod FROM tabela1 WHERE cod NOT IN (SELECT cod FROM tabela2)
But how can I check the records that are not in a table but are in a comma-separated list?
Example: Let’s say I have a table names with the following data:
cod | nome
----|-----------------
1 | César
3 | Maurício
And I want to make a query by passing the following codes 1, 2, 3, 4
hoping the return will be 2, 4
which are the codes that are not in the database.
How can I do that?
Juliano, thank you for answering the question, but I did not put the SGDB because I am looking for something more universal that is not attached to the SGDB nor to a Procedure. Looks like this one query works only for Sqlite.
– Laércio Lopes
It would also be interesting to be able to query by passing the comma-separated list.
– Laércio Lopes
I believe that this solution will always be idiomatic from bank to bank. Unless you create a table just to generate this result.
– Juliano Alves