Hi,
I need to write something like this:
SELECT books.idbook, books.title
FROM books
WHERE EXISTS (SELECT * FROM out_of_stock WHERE out_of_stock.city = 'london'
AND out_of_stock.idbook = books.idbook)
I have one table with all records (eg. books titles) and one table with some of this books (may be the ones not in stock) and the city where they are not available.
So what I want to do is to get a list of them from the first table (books) if and only if they are available in the city I am searching into the query.
to better explain, with the following query I am able to see all books not available in the selected city:
SELECT distinct books.idbook, books.title
FROM books, out_of_stock
WHERE out_of_stock.idbook = books.idbook AND
out_of_stock.city LIKE 'london'
what I need is exactly the opposite: all books except the ones not available.
Is it possible?
thanks