Tricky Date Query

2004-09-07 Thread Lee Denny
Hello, I need to perform a select that compares two dates I need to return all records that haven't had date_2 set after a given number of days since date_1. I'm sure this can be done in one query but I just can't get my head around this one. Can anyone help? Cheers, Lee -- MySQL General

Re: Tricky Date Query

2004-09-07 Thread Michael Stassen
If I understand you correctly, I think you want rows with date_2 not greater than or equal to date_1 plus some number of days, say 30. Then date_2 needs to be less than date_1 plus 30 days. So, you would use something like: SELECT * FROM yourtable WHERE date_2 date_1 + INTERVAL 30 DAY;

Re: Tricky Date Query

2004-09-07 Thread Tobias Asplund
On Tue, 7 Sep 2004, Lee Denny wrote: Hello, I need to perform a select that compares two dates I need to return all records that haven't had date_2 set after a given number of days since date_1. ... WHERE date_2 date_1 + INTERVAL X DAY Where X is the number of days. Assuming this is

Re: Tricky Date Query

2004-08-31 Thread Mike Blezien
Michael, Michael Stassen wrote: Mike Blezien wrote: Hello, Not sure this is possible to do with SQL or if needs to be done with in the application programming language we're using(Perl), but I need to get the a weekdate, IE SELECT EXTRACT(DAY FROM NOW()) which would return 30 Now what I need to

Tricky Date Query

2004-08-30 Thread Mike Blezien
Hello, Not sure this is possible to do with SQL or if needs to be done with in the application programming language we're using(Perl), but I need to get the a weekdate, IE SELECT EXTRACT(DAY FROM NOW()) which would return 30 Now what I need to do, is if the query above is greater or less then

Re: Tricky Date Query

2004-08-30 Thread Michael Stassen
Mike Blezien wrote: Hello, Not sure this is possible to do with SQL or if needs to be done with in the application programming language we're using(Perl), but I need to get the a weekdate, IE SELECT EXTRACT(DAY FROM NOW()) which would return 30 Now what I need to do, is if the query above is