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? 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 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
Archived
This topic is now archived and is closed to further replies.