Skip to content

Instantly share code, notes, and snippets.

@yyoshiki41
Last active December 19, 2015 12:21
Show Gist options
  • Save yyoshiki41/092d3da98424161da656 to your computer and use it in GitHub Desktop.
Save yyoshiki41/092d3da98424161da656 to your computer and use it in GitHub Desktop.
Calculate age from date (1900-01-01)
SELECT (YEAR(current_date())-YEAR(`dob`)) - (RIGHT(current_date(),5) < RIGHT(`dob`,5)) AS age
FROM `table_name`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment