I have an issue with my query,
SELECT id, pseudo, nom, prenom, sexe, ville,
FLOOR(DATEDIFF (NOW(), date_naissance)/365) AS mAge
FROM user
WHERE sexe
I use this query to get age of the user (years and months)
SELECT
username
,date_of_birth
,(PERIOD_DIFF( DATE_FORMAT(CURDATE(), '%Y%m') , DATE_FORMAT(date_of_birth, '%Y%m') )) DIV 12 AS years
,(PERIOD_DIFF( DATE_FORMAT(CURDATE(), '%Y%m') , DATE_FORMAT(date_of_birth, '%Y%m') )) MOD 12 AS months
FROM users
Result as of today:
chucknorris, 1979-04-10 00:00:00, 35, 2