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

  • Home
  • SEARCH
  • 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 9166587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:11:07+00:00 2026-06-17T15:11:07+00:00

Possible Duplicate: Determine Whether Two Date Ranges Overlap I am trying to create a

  • 0

Possible Duplicate:
Determine Whether Two Date Ranges Overlap

I am trying to create a query that selects all the cars in one table based on whether they have a booking in the bookings table. At the moment i have this which works well until if i put a booking from date minus one day and a booking two date plus one day. Because i am using equals it will show a car which is booked within that date range.

How would i alter this so if i have a car in the bookings table with a from date of 22-jan-13 and a to date of 25-jan-13 and a user inputs the from a to dates of 20-jan-13 and 27-jan-13 respectively, the car will not show up in the results.

SELECT   *
FROM vehicles, car_model, manufacture
WHERE NOT EXISTS (SELECT *
                  FROM booking
                  WHERE vehicles.reg_number = booking.reg_number
                  AND booking.date_from = '22-JAN-13'
                  AND booking.date_to = '23-JAN-13'
                  AND booking.booking_status = 1)
AND vehicles.model_code = car_model.model_code
AND car_model.manufacture_code = manufacture.manufacture_code;

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-06-17T15:11:08+00:00Added an answer on June 17, 2026 at 3:11 pm

    Use BETWEEN operator – SELECT ... WHERE ... BETWEEN start_date AND end_date...

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Determine Whether Two Date Ranges Overlap I am trying to work out
Possible Duplicate: Determine if two rectangles overlap each other? Considering I have 2 squares
Possible Duplicate: Check if timestamp is x hours old? How do I determine whether
Possible Duplicate: Real numbers - how to determine whether float or double is required?
Possible Duplicate: Determine whether client browser has java installed and can launch applets I
Possible Duplicate: MySQL: determine which database is selected? I'm trying to debug some problems
Possible Duplicate: How to determine whether a given Linux is 32 bit or 64
Possible Duplicate: Determine a string's encoding in C# I believe if I create a
Possible Duplicate: How to determine the date one day prior to a given date
Possible Duplicate: Best way to determine if two path reference to same file in

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.