Consider that I have two tables.
One is “Table1” as shown below.

One more table is “Table2” as shown below.

Now here what I need is, I need all the records from Table1 those ID’s are not in Table2’s Reference column.
Please guide me how to do this.
Thanks in advance.
How to do it with your current schema (impossible to use indexes):
How this works is by completely wrapping every value in the
Referencecolumn with commas. You will end up with,2,3,and,7,8,9,for your sample data. Then you can safely search for,<Table1.ID>,within that string.How to really do it:
Normalize your database, and get rid of those ugly, useless comma-separated lists.
Fix your table2 to be:
SlNo | Reference ------+----------- 1 | 2 1 | 3 2 | 7 2 | 8 2 | 9and add a table2Names as:
SlNo | Name ------+--------- 1 | Test 2 | Test 2Then you can simply do: