merging data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ralucacori
    New Member
    • Dec 2010
    • 1

    #1

    merging data

    Please help me.

    I have a hotel reservation database and I don't know how to find out for each day how many rooms, grouped by type are booked

    I have table hotel (hotel_id, hotelname, address)
    Rooms(room_id, type, services)
    HotelRooms(hote l_id,room_id,nu mberofrooms,pri ceperroom)
    Client(Client_i d,name,telephon e)
    Bookings(Bookin g_id,client_id, hotel_id,room_i d, dateofstart, dateofend)

    I don't know how to merge date intervals so pls I need an advise
  • jimatqsi
    Moderator Top Contributor
    • Oct 2006
    • 1293

    #2
    If you know the date you are running the report for you could do something like this:

    Code:
    select hotel_id, Count(room_id) as Rooms from Bookings where #1/3/2011# is between [dateofstart] and [dateofend]
    If you need to run it for a range of dates, you'll need to do it a little differently.

    I don't see hotel room type in the bookings table, so you'll have to pull that from a join on the Rooms table.

    Jim

    Comment

    Working...