Canman2005 Posted August 2, 2008 Share Posted August 2, 2008 Hi all I have a table called "members" and a field called "dob", is it possible to do a query to say get the age of any members from 30 to 40 using the "dob" field? The "dob" field is stored like 1975-05-18 (YYYY-MM-DD) Can anyone help? Thanks Dave Link to comment https://forums.phpfreaks.com/topic/117857-solved-query-dob-on-age/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 2, 2008 Share Posted August 2, 2008 There is an example of calculating age at this link - http://dev.mysql.com/doc/refman/5.0/en/date-calculations.html Simply adding your 30 to 40 age conditions in a WHERE clause should work. Link to comment https://forums.phpfreaks.com/topic/117857-solved-query-dob-on-age/#findComment-606198 Share on other sites More sharing options...
DeanWhitehouse Posted August 2, 2008 Share Posted August 2, 2008 you would have to do something like mysql_query("SELECT * FROM members WHERE dob > '1975-05-18' AND dob < '1975-05-18'") or something Link to comment https://forums.phpfreaks.com/topic/117857-solved-query-dob-on-age/#findComment-606199 Share on other sites More sharing options...
Canman2005 Posted August 2, 2008 Author Share Posted August 2, 2008 thanks Link to comment https://forums.phpfreaks.com/topic/117857-solved-query-dob-on-age/#findComment-606205 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.