Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Age Calculation - response (16) by dmcpdx

$
0
0

Here's so it works on leap years ( i.e. current_date = date'2012-02-29' )
SELECT (EXTRACT(YEAR FROM CURRENT_DATE) - EXTRACT(YEAR FROM brth_dt) (NAMED YEARS))
      + CASE WHEN add_months( CURRENT_DATE , - YEARS * 12 )  < brth_dt
             THEN -1 ELSE 0 END AS age_whole_yrs


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>