My site contains a database of a group of friends, all with profiles and their date of birth entered. I need a query to show when the next birthday & the date it is, also how old they will be.
EG:
Next Birthday: Ian Gunter will be 28 on the 11th July
I have come up with thisThis selects the first birthday that happens that year, I need it to somehow reference today date and sort from there, but when I use the d_o_b2 field name in the WHERE clause, I get error # 1054 (unknown column).Code:SELECT id, name_f, name_l, DATE_FORMAT(d_o_b,'%m %D') AS d_o_b2 FROM users WHERE d_o_b <=CURDATE() ORDER BY d_o_b2 ASC LIMIT 0,1
I also can't figure out ho to use the year to work out how old they will be.
Any ideas?
Gunter










Bookmarks