Ok my objective is to query table 1 for data, but make sure that the data has not already been presented by checking in table 2.
Each data has an ID which is under the UUID column.
Select * FROM table1 Where Not Exists
(SELECT * FROM table2 WHERE table2.UUID = table1.UUID);
But I have researched and I have tried every possible way to write that query and I keep getting:
"ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE NOT EXISTS (SELECT * FROM table2 WHERE table2.UUID = table1.UUID) at line 1"
Any help?
Also some of the articles I found on the internet suggest that a join would be more efficient, but others state that where not exists is better. Which is the more efficient route?
Thanks
i think you have to that like this:
this means that the query selects all records from table1 where
UUID
in table1 does not exist in table2