>>Hi,
>>I'm having the following sql problem:
>>I have two datetime fields (start and end), I need to find out if the
>>month is either equal to start-month or equal to end-month but also
>>if it's a month between start and end. I also check if the end-date
>>is greater than today so it's a current one.
>>
>>My problem is that I can't get the months in between when, how do I do that?
>>Any ideas?
>>$current_month is a php variable.
>>
>>(MONTH(start)= '$current_month' OR MONTH(end) = '$current_month') AND
>>end >= CURDATE()
>>
>>Greetings from Sweden
>>Jimmy.

Sir, try
    (MONTH(start) >= $current_month AND MONTH(end) <= $current_month)
    AND end >= CURDATE()

The MS Titanic (my wintel machine) just sank again, so I don't have a 
machine I can run the statement on to see if it is correct.

Bob Hall

Know thyself? Absurd direction!
Bubbles bear no introspection.     -Khushhal Khan Khatak
MySQL list magic words: sql query database

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to