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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted August 2, 2008 Author Share Posted August 2, 2008 thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.