user3444727
user3444727

Reputation: 21

difference between oldest and youngest birthdates

I am trying to write a query in order to pull up the age difference between the oldest and youngest pilots in my pilots table - so far I've tried this which returns days when I need years:

SELECT ROUND(MAX(PIL_BRTHDATE)-(MIN(PIL_BRTHDATE),2) AS "AGE DIFFERENCE" FROM PILOTS;

The ROUND is there because my professor wants it rounded to the 2nd decimal.

I tried the DATEDIFF function but since I can't just input the start and end dates manually it's not working (YY,"STARTDATE","ENDDATE").

For example I tried:

DATEDIFF(YY,MAX(PIL_BRTHDATE),MIN(PIL_BRTHDATE))...IT KEEPS SAYING INVALID IDENTIFIER

Upvotes: 2

Views: 532

Answers (1)

sotondolphin
sotondolphin

Reputation: 223

EXTRACT (YEAR FROM YOUR DATES)

Upvotes: 1

Related Questions