I am trying to find a list of people based on renewal dates, the logic of
the query would be:

Select everything from the db where the last renewal date is between a and
b, or if there is no last renewal date then where the signup date is between
a and b

The query that I have is something like:

Select * 
from db 
where last_renewal_date
    between '2004-11-01' and '2004-11-30' or
    if(
        length(last_renewal_date) < 1,
        signup_date between '2004-11-01' and '2004-11-30'
    ) 
order by last_renewal_date

Obviously the syntax is wrong here, but is there a way to accomplish this
logic using an if statement in the where statement?

TIA!

--
Cheers

Mike Morton

****************************************************
*
* Tel: 905-465-1263
* Email: [EMAIL PROTECTED]
*
****************************************************

"Indeed, it would not be an exaggeration to describe the history of the
computer industry for the past decade as a massive effort to keep up with
Apple."
- Byte Magazine

Given infinite time, 100 monkeys could type out the complete works of
Shakespeare. Win 98 source code? Eight monkeys, five minutes.
-- NullGrey 



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to