Connecting Tech Pros Worldwide Forums | Help | Site Map

How to retrieve comings birth days

kamill's Avatar
Member
 
Join Date: Dec 2006
Location: within compiler
Posts: 65
#1: Jul 1 '08
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

hsriat's Avatar
Expert
 
Join Date: Jan 2008
Location: Bath, UK
Posts: 1,609
#2: Jul 1 '08

re: How to retrieve comings birth days


Try to use DATE_FORMAT in the ORDER BY statement.
amitpatel66's Avatar
Moderator
 
Join Date: Mar 2007
Location: Hyderabad, India
Posts: 2,192
#3: Jul 2 '08

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