+ 1
Calculating age in sql having just the Personal Identification number
Can anyone help me to solve the sql problem regarding the age , having just the personal identification number , eg: 2920801( DOB is 01.Aug.1992). Thank you
1 Answer
+ 2
There's not much information to go on here. All I can see is that the identification number appears to be formatted with the year of birth in two digits and in reverse.
1992: 29 ??: 2 08: 08 01: 01
I'm guessing you have a better description of how this number works.
From there you can use substrings to break it apart.
SELECT MID(ID, 1,2) as YEAR, MID(ID, 4,2) as MONTH, MID(ID, 6,2) as DAY
FROM whatever
Then expand that by converting to a DATE value and perform date math to determine AGE. It would turn into a much longer SQL statement that returns only the AGE.