Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

How to retrieve comings birth days

Question posted by: kamill (Member) on July 1st, 2008 08:12 AM
Dear Strange Friends,

I need to fetch birth date (in dd-mm format) in ascending order start from current date(dd-mm format), But i am unable to write appropriate query. i have stored dateofbirth in date format(yyyy-mm-dd) in mysql DB.

i.e. if i have stored DOBs as 1999-07-11,2002-10-21,2004-06-15,2001-07-05,1994-08-17 and 2001-08-01 and current date is 2008-07-01 than my result must be looks like below

2008-07-05 (05-07)
1999-07-11 (11-07)
2001-08-01 (01-08)
1994-08-17 (17-08)
2002-10-21 (21-10)
2004-06-15 (15-06)

But i have much frustrated to how to achieve this. Please Help.

Thanks,
Kamil
Last edited by kamill : July 1st, 2008 at 08:14 AM. Reason: Spelling mistake
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
hsriat's Avatar
hsriat
Expert
1,460 Posts
July 1st, 2008
06:08 PM
#2

Re: How to retrieve comings birth days
Try to use DATE_FORMAT in the ORDER BY statement.

Reply
amitpatel66's Avatar
amitpatel66
Moderator
1,843 Posts
July 2nd, 2008
06:28 AM
#3

Re: How to retrieve comings birth days
ORDER BY Month - date in your query using DATE_FORMAT function as suggested in the above post

Reply
Reply
Not the answer you were looking for? Post your question . . .
182,318 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Top MySQL Forum Contributors