0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Bigqueryで誕生日から年齢を算出する

Last updated at Posted at 2019-08-22

案外いい感じの関数がなかったのと、業務で書く必要があったので。

DATE_DIFF(CURRENT_DATE(),birthday,YEAR) +
  (CASE WHEN 
    EXTRACT(DAYOFYEAR FROM birthday) > EXTRACT(DAYOFYEAR FROM CURRENT_DATE()) 
  THEN -1 ELSE 0 END) ;;

※birthdayはカラム名

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?