SELECT comparing to entire column
Posted on 2004-10-15
I have a query I am trying to do that I can not figure out. Any help will be appreciated.
I am trying to compare records in two tables (property and hotel_specific). Some records will have a link (p.id = h.trav_id) but for some the "h.trav_id" is missing. I want the results of the query to show all the records that are NOT a match. I have tried the below query but it even returns records that do have a match.
SELECT DISTINCT p.id, p.name, c.country_name
FROM property p, countries c, hotel_specific h
WHERE p.country = c.country_code
AND c.country_rid IN (6)
AND p.id != h.trav_id
Any body have the answer?