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
This is the simplest I could come up with so far:
SELECT FLOOR(ABS(DATEDIFF(d, CURRENT_TIMESTAMP, dob))/365.25) AS age
First we get the date difference in days, then convert it to years, then FLOOR truncates to the integer part of the number.