llandudno Posted July 4, 2006 Share Posted July 4, 2006 Hi folks, been away for a bit, and forgotten some things, anyhow, can you pls help. I have 2 tables in a DB, one contains a list of "rooms' the other is for room availability. - based on date.All I want to do is find out which rooms are available on certain dates. e.g: $sql = "SELECT * FROM roomlist LEFT JOIN roomavailability ON roomavailability.roomlistID=roomlist.roomlistID WHERE roomavailability.datefrom BETWEEN $adate AND $departdate AND roomavailability.dateto BETWEEN $adate AND $departdate"; $rs = mysql_query($sql) or die("Error: " . mysql_error()); while ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) { echo $row['roomlistID']; }This query gives me the right results for rooms that have been booked, but what I actually want is roomlistID from roomlist if it is not in the above query. understand?Help much appreciated, thanks Quote Link to comment https://forums.phpfreaks.com/topic/13620-help-pls-find-records-not-in-1-table-but-in-another/ Share on other sites More sharing options...
.josh Posted July 4, 2006 Share Posted July 4, 2006 this may be a real dumb answer, but you are saying you want the opposite result, right? did you try ... roomavailability.roomlistID != roomlist.roomlistID ....? Quote Link to comment https://forums.phpfreaks.com/topic/13620-help-pls-find-records-not-in-1-table-but-in-another/#findComment-52791 Share on other sites More sharing options...
llandudno Posted July 4, 2006 Author Share Posted July 4, 2006 Sorry but ... roomID!=roomlist.roomlistID does not give the result I want. Quote Link to comment https://forums.phpfreaks.com/topic/13620-help-pls-find-records-not-in-1-table-but-in-another/#findComment-52841 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.