I have a table called ‘bandsplusrating’ and a table called ‘ratings’
The table ‘bandsplusrating’ is filled with bands, the table ‘ratings’ starts empty.
Both tables have field called ‘naam’ with which they can be joined.
Table ‘ratings’ has a field called ‘fullname’
Multiple Ratings per band (bandsplusrating) will be stored in table ‘ratings’
Now i want to display all records from ‘bandsplusrating’ which havent been rated by a given user (ratings.fullname)
SELECT b.naam, b.stijl
FROM bandsplusrating b
LEFT JOIN ratings r ON b.naam = r.naam
WHERE r.fullname NOT LIKE 'Obama'
This query will still display a record when an other user has rated it.
Im am struggeling for days now, can someone assist me ?
Thanks!
Using NOT IN:
Using NOT EXISTS:
Using LEFT JOIN/IS NULL:
Performance
Of the three options, the
NOT INandLEFT JOIN/IS NULLperform equally.NOT EXISTSdoesn’t perform as well.