mysql - SQL - Query multiple rooms with different Adults/Children per hotel -


I have a simple query where I select the X space available with the X ad + x children per hotel that matches a date range, but I have difficulty finding out how to ask the list of rooms of each hotel:

  • 1 with 2 adults
  • 1 room with 2 adults / 1 children

    My query here Is: < / P>

      SELECT COUNT (pl.day) AS day, P.Property_ID AS Hotel_ID, P.N.A. AS HOTEL_NAME, Arkrum_nam AS Room_Name, Arkrum_taip_aidi AR Room_ID property P Join INNER room_type r ON p.property_ID = r .property_ID and (r.max_adults> gt; = 3 and r.max_children & gt; = 0) pl .room_type_ID = Join the R.Room_type_ID and (pl.day> = "2014-07-07" and plan on pl.DAY   

    edit

    How do I 'no_of_room' in SELECT Code> Add, it is different by the number of rooms, rent to room_types , the example of a room Example:

      Array ([Room_Price] => 160.00 [day] => 4 [hotel_id] => 1 [hotel_name] => Hotel Alfa [Room_Name ] = & Gt; Room Type C [Room_ID] => 3 [Max_Adult] => 3 [Max_Child] => 1 [NO_of_room] => Which room type of this room? )   

    Then I can look like the result:

    Edit :

    The query has been edited to return only with three room types. This scheme has also been joined with the table.

      SELECT COUNT (pl.day) AS day, p.property_ID AS Hotel_ID, p.name AS Hotel_Name, r.room_name AS Room_Name, Max_Adults as r room_type_ID Room_type_ID, the r.max_children include Max_Children property P join INNER room_type r on p.property_ID = r.property_ID as to pl.room_type_ID = r.room_type_ID on Plan pl and (pl.day & gt; = '2014-07-07' and pl. day & lt; = '2014-07-11') which offers (room 1 type 1 r1 wHERE p.property_ID = r1.property_ID and r1.max_adults = 2 and r1.max_children = 0) and current (choose 1 Rum_prkar r2 WHERE p2.property_ID = r2.property_ID and r2.max_adults = 4 and r2.max_children = 2) and room_type r3 current (choose 1 WHERE P.PROPERTY_ID = R3.PROPERTY_ID and r3.max_adults = 2 and r3. max_children = 1) by GROUP p. Proprti_aidi, Pi.an.ank, Arkrum_nav, Arkrum_taip_aidi, Ar.amaks_aandlts, Ar.amaks_chulden Having COUNT (PL. DE) = 4;    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -