Retrieving specific tuples using Mysql

Posted by Narayanan on Stack Overflow See other posts from Stack Overflow or by Narayanan
Published on 2010-02-15T23:02:15Z Indexed on 2010/05/05 4:28 UTC
Read the original article Hit count: 259

Filed under:

Hi, I have some problems retrieving specific tuples. I am actually a student trying to build a Room management system. I have two tables:

Room(roomID,hotelname,rate) 

and

Reservation(resID,arriveDate,departDate,roomID).

I am not sure how to retrieve the rooms that are available between 2 specific dates. This was the query that i used.

SELECT Room.roomID,hotelname,rate 
  FROM Room 
  LEFT JOIN Reservation 
    on (     Room.roomID=Reservation.resID 
         and arriveDate >='2010-02-16' 
         and departDate <='2010-02-20'
       ) 
 GROUP BY roomID,hotelname,rate 
HAVING count(*)=0;'

but it returns an empty set. Can any1 be kind enough to tell me what mistake i am doing??

© Stack Overflow or respective owner

Related posts about mysql