I am trying to do the following but I dont have enough experience with MySQL. Would it be possible for someone to tell me what the query for this will be.
I have a databse with 2 tables
Brief and Info have various fields but I am interested in only ID field.
This is what I am trying to do.
I want to go through all the IDs from Brief and cross reference them with all the IDs that exists in Info and only get the ones that exist in Info but dont exist in Brief
Thanks
SELECT i.ID
FROM Info i
LEFT JOIN Brief b USING(ID)
WHERE b.ID IS NULL
Alternatively:
SELECT i.ID
FROM Info i
WHERE NOT EXISTS (
SELECT 1
FROM Brief b
WHERE b.ID = i.ID
)
See these 2 links for performance comparisons:
SELECT ID FROM INFO
WHERE ID NOT IN
(SELECT ID FROM BRIEF);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With