I need to calculate the age of a "customer" from their date of birth.
I have tried to use the following:
DATEDIFF(year, customer.dob, "2010-01-01");
But it does not seem to work.
Any ideas? I KNOW it is going to be something simple!
Thanks
SELECT DATE_FORMAT(NOW(), '%Y') - DATE_FORMAT(dob, '%Y') - (DATE_FORMAT(NOW(), '00-%m-%d') < DATE_FORMAT(dob, '00-%m-%d')) AS age
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With