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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:51:47+00:00 2026-06-18T06:51:47+00:00

Kindly see the Table Structure , Query and the Result. MeetingRoom ID | Area

  • 0

Kindly see the Table Structure , Query and the Result.

MeetingRoom

   ID | Area | RoomNo    Capacity   distances 
   --- ----- --------- ---------- ----------
   1   1     R1         10        10        
   2   1     R3         24        4         
   3   8     R4         24        4         
   4   1     R5         10        10     

ReservationTable

ReservationID RoomID      DateTimeStart           DateTimeEnd             
------------- ----------- ----------------------- ----------------------- 
1             1           2013-10-10 17:00:00.000 2013-10-10 19:00:00.000 

Query

 Declare @Start Datetime
 Declare @End Datetime

 set @Start='2013-10-10 13:00:00.000'
 set @End='2013-10-10 14:00:00.000'

 select 
     MeetingRoom.ID 
 from 
    MeetingRoom 
    left Join ResReservationTable Res on Res.RoomID = MeetingRoom.ID
 Where 
   Res.DateTimeStart != @Start and Res.DateTimeEnd != @End
   and (Res.DateTimeStart Not Between @Start and @End) 
   and (Res.DateTimeEnd Not Between @Start and @End)

This Query is Returning only one record as it should return 4 Records

  • 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-06-18T06:51:48+00:00Added an answer on June 18, 2026 at 6:51 am

    If you use LEFT OUTER JOIN and in WHERE clause set condition to right-hand table rather than IS NULL in result you have INNER JOIN.

    I think this is what you want.

    Declare @Start Datetime
    Declare @End Datetime
    
    set @Start='2013-10-10 13:00:00.000'
    set @End='2013-10-10 14:00:00.000'
    
    select 
         MeetingRoom.ID 
    from 
        MeetingRoom 
        left Join ResReservationTable Res on Res.RoomID = MeetingRoom.ID
    Where
      (
       Res.DateTimeStart != @Start and Res.DateTimeEnd != @End
       and (Res.DateTimeStart Not Between @Start and @End) 
       and (Res.DateTimeEnd Not Between @Start and @End)
      )
      OR Res.ReservationID IS NULL
    

    I think you must rephrase your WHERE condition. If you want room which fully free (i.e. intervals not intersect) you can use this:

    WHERE
       Res.DateTimeStart > @End
       OR Res.DateTimeEnd < @Start
       OR Res.ReservationID IS NULL 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

someone kindly posted this code for me but it only returns /table in the
I have table structure like below: events (boxing, sparring etc) competitors (users who are
Kindly see this page: http://www.technodoze.com See the Button in the Categories on the right
Kindly Tell Me What is the best software to design GUI which is the
Kindly point out if i have missed something? I have a project with type
Kindly i have a page and in the page i have two pie charts,
Please kindly help me in the following, I have $sub = C:\views\sght\gzad\text\hksdk\akldls\hool.java = C:\views\sght\bdsk\text\hksdfg\sdjks\same.java
Please kindly advise on benchmarks used to test a C and C++ allocator? Benchmarks
With some kindly help from StackOverflow, I've got Unity Framework to create my chained
Would someone kindly explain why the following bit of code works, I've tested it

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.