I’m using this query to calc an user age:
SELECT
((YEAR(CURDATE())-YEAR(um.date_birth)) - (RIGHT(CURDATE(),5)<RIGHT(um.date_birth,5)))
FROM user_meta AS um
WHERE um.uid = 2
I wonder if there’s a fastest / lighter way to do it.
I’m using this nested in a bigger select, so I wouldn’t mind to somehow enhance the overall performance. Thank you.
1 Answer