No.Well... if you were given a start date of 2003-01-01 and end date of 2003-01-31...
select * from table_name where start_date between "2003-01-01" and "2003-01-31" or end_date between "2003-01-01" and "2003-01-31"
No?
Example: start_date = "2002-01-01" and end_date = 2003-02-01".
Instead, if the four dates are s1, e1, s2, and e2 (s=start, e=end), we want: s1 <= e2 /* first range can't start after second range ends */ AND s2 <= e1 /* second range can't start after first range ends */
Bruce Feist
Matt.
On Wed, 2003-04-02 at 16:32, Sarah Heffron wrote:
How would I do this:
I have a date range (start date and end date) supplied by the user and I also have information in a table that has start dates and end dates. I want to select everything in the table whose date range overlaps in any way with the date range given by the user.
Thanks, Sarah
__________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]