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 1021981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:23:36+00:00 2026-05-16T11:23:36+00:00

i had a situation in my project that is as follows. while checking for

  • 0

i had a situation in my project that is as follows.

while checking for the available rooms

$sel_from_bookings="SELECT room_no FROM `booking` WHERE (('".$_POST['req_tdate']."' BETWEEN check_indate AND check_outdate) OR ('".$_POST['req_fdate']."' BETWEEN check_indate AND check_outdate)";

$sel_from_reserv="SELECT room_no FROM `reservation` WHERE (('".$_POST['req_tdate']."' BETWEEN check_indate AND check_outdate) OR ('".$_POST['req_fdate']."' BETWEEN check_indate AND check_outdate))"; 

$sel_rooms="SELECT room_no FROM rooms WHERE room_no NOT IN (".$sel_from_bookings.") AND room_no NOT IN (".$sel_from_reserv.")";

The first query retrives the list of room numbers from the booking table which satisfies the daterange

similarly the second one dos same from the table reservation

the last query uses the list provided by the above two queries and gets the list of room which are not in the generated list.

works fine for 10-08-2010 / 15-08-2010

works fine for 20-08-2010 / 25-08-2010

when i give the dates between 10 and 15 it works fine similarly for 20 and 25 and also works fine for the dates 14-08-2010 and 21-08-2010

but not working for 16-08-2010 to 19-08-2010

need any clarification please ask me.

Thanks.

  • 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-16T11:23:36+00:00Added an answer on May 16, 2026 at 11:23 am
    SELECT  *
    FROM    room
    WHERE   room_no NOT IN
            (
            SELECT  room_no
            FROM    booking
            WHERE   check_outdate >= @req_fdate
                    AND check_indate <= @red_tdate
            )
            AND room_no NOT IN
            (
            SELECT  room_no
            FROM    reservation
            WHERE   check_outdate >= @req_fdate
                    AND check_indate <= @red_tdate
            )
    

    Pay attention to the order or the arguments: @req_fdate here is the first date here (from), @req_tdate is the last date (till).

    To check for availability from Aug 16 to Aug 19, use this:

    SELECT  *
    FROM    room
    WHERE   room_no NOT IN
            (
            SELECT  room_no
            FROM    booking
            WHERE   check_outdate >= '2010-08-16'
                    AND check_indate <= '2010-08-19'
            )
            AND room_no NOT IN
            (
            SELECT  room_no
            FROM    reservation
            WHERE   check_outdate >= '2010-08-16'
                    AND check_indate <= '2010-08-19'
            )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I came across a situation that I had in another project that I'm not
As a project over summer while I have some downtime from Uni I am
I have an ASP.NET website project that until recent had all code in App_Code
I had a situation on a dev server where all the ASP.Net applications we
I’m using Coldfusion MX 8. I recently had a situation where variables seem to
I ran into a situation where two machines both had microsoft.teamfoundation.testmanagement.client.dll in the GAC
I recently came across a situation where I had to use XPath as part
i am facing a new situation. I know someone definitely had faced these type
I have had several situations when i would like to do that. This could
Had to download Command Line Tools from Apple to get make to work, but

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.