EchoFool Posted October 10, 2011 Share Posted October 10, 2011 Hey, I have a table which stores userid and birthday. The birthday is in the format of YYYY-MM-DD And im trying to do a query to search for all userid's that are between the ages of two ages, lets say 18 and 30. How would i do this ? Do i have to use a php function in the query? Quote Link to comment https://forums.phpfreaks.com/topic/248848-select-rows-within-a-date-rate/ Share on other sites More sharing options...
awjudd Posted October 10, 2011 Share Posted October 10, 2011 SELECT userid, birthday FROM users WHERE birthday BETWEEN DATE_ADD(CURDATE(), INTERVAL 30 YEAR) AND DATE_ADD(CURDATE(), INTERVAL 18 YEAR) ~juddster Quote Link to comment https://forums.phpfreaks.com/topic/248848-select-rows-within-a-date-rate/#findComment-1277954 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.