I am using MySql 5.7.18-log
.
I have a query as follows, which result name and date of birth in output.
select uid,Name, Dob from table1;
Data:
uid Name Dob
K-1 Alex 1996-01-01 05:30:00
K-2 Mike 1983-05-26 05:30:00
K-3 Jim 1992-12-29 05:30:00
I want to extract age using the year and month of Dob
column and extracting it from the current year and month.
Required output:
uid Name Dob Age
K-1 Alex 1996-01-01 05:30:00 25
K-2 Mike 1983-05-26 05:30:00 37
K-3 Jim 1992-12-29 05:30:00 28