can anyone pls help me out to make the query like.. if two tables have some comman records then how to find records from one table that are not in another table.
i have one table room type master (room_type_m)
fields : room_type_id, room_type_name and other details
and another table hotel room type relation (hotel_rtype_r) fields : hotel_id and room_type_id and some other fields this table will contain multiple room_type_ids for one hotel_id
i want to print those room_type_id (from room_type_m) that are not present in relation table ie .(hotel_rtype_r)
You need a LEFT JOIN
SELECT r.room_type_id FROM room_type_m r LEFT JOIN hotel_rtype_r h ON r.room_type_id = h.room_type_id WHERE h.room_type_id IS NULL
I'd suggest you pick up an SQL book or do some more reading if you don't understand that.
-- ---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
PHP|Architect: A magazine for PHP Professionals – www.phparch.com
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php