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

Age Calculation - response (15) by dmcpdx

$
0
0

Here's the change to make this work for ages > 100.  Added "(3)" for precision. 
SELECT (EXTRACT(YEAR FROM CURRENT_DATE) - EXTRACT(YEAR FROM brth_dt) (NAMED YEARS))
      + CASE WHEN CURRENT_DATE - (YEARS (INTERVAL YEAR(3))) < 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>