Hi,
I recently had to try and roughly work out the age of a borrower based on their date of birth in msquery to export into a pivot table.
This is my solution.
1
2Age=(case
3length(char(date_trunc('day','today')-borrower_main.birth,10))
4when 10 then
5int(left(char(date_trunc('day','today')-borrower_main.birth,10),5)/365.25)
6when 9 then
7int(left(char(date_trunc('day','today')-borrower_main.birth,10),4)/365.25)
8when 8 then
9int(left(char(date_trunc('day','today')-borrower_main.birth,10),3)/365.25)
10else ''
11end),
It's not perfect as leap years can cause it to be out by a year.
Does anyone else have a better way of doing this?
Steve