Ok I spoke too soon,

I did this:

SELECT * FROM users
WHERE ((MONTH(user_data.User_DOB) * 100) + DAYOFMONTH(user_data.User_DOB))
BETWEEN 521 AND 621

as in I multiplied MONTH with 100 and added the DAYOFMONTH

Marc.

"Marc Greenstock" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all,
>
> I am trying to provide a star sign search so that the user can search for
> any given star sign eg Gemini and retrieve all the users who belong to
that
> sign.
>
> I have a table with all the star signs, in the table are the fields
> 'Name','From','To'. Both the 'From' and 'To' are an integer of the
relevant
> dates eg in the 'Gemini' row I have:
>
> Gemini, 521, 621 (521 means May 21st, 621 means June 21st). I hope I'm
> explaining my self ok.
>
> Now in the users table I have date of birth stored in the Date format eg;
> 1979-06-20.
>
> Here is my current stab at this.
>
> SELECT * FROM users
> WHERE MONTH(user_data.User_DOB) >= 5
> AND DAYOFMONTH(user_data.User_DOB) >= 21
> AND MONTH(user_data.User_DOB) <= 6
> AND DAYOFMONTH(user_data.User_DOB) <= 21
>
> Obviously this wont work because anyone born, lets say on the 20th will
not
> fit that criteria.
>
> I've tried other methods but I cant seem to figure out the correct syntax.
>
> I thought using CONCAT may work eg:
>
> SELECT * FROM users
> WHERE CONCAT(MONTH(user_data.User_DOB),DAYOFMONTH(user_data.User_DOB))
> BETWEEN 521 AND 621
>
> but that doesn't seem to work either.
>
> Can someone help please?
>
> Thanks in advance.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to