Re: how to get records from one table that are not in another table
| From: | Smita Manohar | Date: | Mon, 28 Jul 2003 02:15:43 +0000 |
| Subject: | Re: how to get records from one table that are not in another table | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-29505@lists.php.net to get a copy of this message | ||
heyy...
i put second condition (after "AND") in the wrong place.. it should be after LEFT JOIN ON....
not after WHERE... following is the correct query...
SELECT A.room_type_id, room_type_desc FROM room_type_m A LEFT JOIN hotel_room_type_d B ON A.room_type_id = B.room_type_id AND B.hotel_id = '$hotel_id' WHERE B.room_type_id IS NULL
previously i was doing....
SELECT A.room_type_id, room_type_desc FROM room_type_m A LEFT JOIN hotel_room_type_d B ON A.room_type_id = B.room_type_id WHERE B.room_type_id IS NULL AND B.hotel_id = '$hotel_id'
with this query it was only printing messege as,"query executed successfully" in phpmyadmin but not printing the result.
anyway, now my problem is solved..
thanks !
- smita
_________________________________________________________________
Cool new emoticons. Lots of colour! http://server1.msn.co.in/sp03/messengerpromo/index.asp On MSN Messenger V6.0