Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6683921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:52:43+00:00 2026-05-26T04:52:43+00:00

Extending on this question: hotel reservation system SQL query: identify when one specific room

  • 0

Extending on this question:
hotel reservation system SQL query: identify when one specific room is available

Using the schema listed in the question above, how can I have a query that says “Find me a room for 2 consecutive days thats available in this week?”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:52:44+00:00Added an answer on May 26, 2026 at 4:52 am

    Just join to the availability table twice

    SELECT rooms.* FROM rooms, availability as a1, availability as a2
    WHERE rooms.id = 123
    AND a1.room_id = rooms.id
    AND a2.room_id=  rooms.id
    AND a1.date_occupied + 1 = a2.date_occupied
    

    or, if we’re not into writing SQL like its 1985:

    SELECT rooms.* FROM rooms
    JOIN availability a1 on a1.room_id = rooms.id
    Join availability a2 on a2.room_id = rooms.id AND a1.date_occupied + 1 = a2.date_occupied
    WHERE rooms.id = 123
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Extending from this questions about locales And described in this question : What I
This question is related to extending class methods in Ruby, perhaps more specifically in
This question was asked already here , but rather than answering the specific question,
I roamed the site for this question using the search engine, and I don't
I've a question extending the code in this question : Can you multiply two
EDIT: looking for this: http://diminishing.org/extending-formtastic-with-a-sprinkle-of-jquery (If this works I'll answer my own question) I've
The gist of this question is about extending a class, minimizing jam-packing everything into
Expanding this question on how I learnt to pass from problem description to code
Expanding on this question , what is the best way to develop against both
So I found this: http://tiles.apache.org/framework/tutorial/advanced/nesting-extending.html Here is the example: <definition name=myapp.homepage template=/layouts/classic.jsp> <put-attribute name=title

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.