Skip to content
Advertisement

how to find Age from DOB in Athena?

Here is my query to find out age from the DOB column :

I am getting following error:

SYNTAX_ERROR: line 4:47: ‘-‘ cannot be applied to varchar, varchar

Appreciate your help!

Advertisement

Answer

You should be able to solve this using function DATE_DIFF(). From the documentation:

date_diff(unit, timestamp1, timestamp2)bigint

Returns timestamp2 - timestamp1 expressed in terms of unit.

Try:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement