Date range/query problem..
Posted
by Simon
on Stack Overflow
See other posts from Stack Overflow
or by Simon
Published on 2010-06-12T08:57:38Z
Indexed on
2010/06/12
9:02 UTC
Read the original article
Hit count: 233
Am hoping someone can help me out a bit with date ranges...
I have a table with 3 fields id, datestart, dateend
I need to query this to find out if a pair of dates from a form are conflicting i.e
table entry 1, 2010-12-01, 2010-12-09
from the form 2010-12-08, 20-12-15
select id from date_table where '2010-12-02' between datestart and dateend;
That returns me the id
that I want, but what I would like to do is to take the date range from the form and do a query similar to what I have got that will take both form dates 2010-12-08, 20-12-15
and query the db to ensure that there is no conflicting date ranges in the table.
Am sat scratching my head with the problem...
TIA
© Stack Overflow or respective owner