0

I want to select the records that have a specific in between date, let me explain this in an example: I have this table:

contracts
id | date_start | date_finish
1  | 2011-01-01 | 2011-01-15
2  | 2012-02-15 | 2012-03-15
3  | 2012-02-16 | 2012-02-25

I want to show the contracts that were open in this date '2012-02-17', if I do this query it would output contracts 2 and 3, if I searched this date '2012-03-14' it would output contract 2...how can I make this query?

Thanks!!

1 Answer 1

4
SELECT * FROM contracts WHERE your_date BETWEEN date_start AND date_finish

However, I think "if I searched this date '2012-03-14' it would output contract 3.." should ouptut contract 2, since 2012-03-14 is between 2012-02-15 and 2012-03-15.

Sign up to request clarification or add additional context in comments.

1 Comment

I didn't know that I could use between like that...THANKS!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.