If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
I have an 'albums' table and I have a 'restrictions' table. I want to pull all of the albums except the ones that are restricted from a certain territory.
e.g.
SELECT * FROM albums [except WHERE album.cat_no = restrictions.cat_no AND territory = 'GB']
How would I go about turning the bit in the brackets into a real life query? Bearing in mind some albums will have no restrictions.
select a.*
from albums a left outer join restrictrions r on a.cat_no = r.cat_no and
territory = 'GB'
where r.cat_no is null
Regards,
Kris
Hi Kris,
I tried the following:
Quote:
SELECT DISTINCT(id), title, artist, cat_no, description, release_date FROM albums LEFT OUTER JOIN territory_restrictions ON albums.cat_no = territory_restrictions.restrictions_cat_no AND territory_restrictions.restrictions_territory = 'US' WHERE publish = 1 AND deleted != 1 AND territory_restrictions.restrictions_cat_no = NULL ORDER BY cat_no ASC LIMIT 0, 5
Which does not give me an error, but yields no results.