Skip to content

Instantly share code, notes, and snippets.

@yuba
Created December 6, 2017 22:24
Show Gist options
  • Save yuba/145a3f3b7f75e4f3e88a614ea5431013 to your computer and use it in GitHub Desktop.
Save yuba/145a3f3b7f75e4f3e88a614ea5431013 to your computer and use it in GitHub Desktop.
カラムにnullが含まれるなら結果がnullになるmax() ref: https://qiita.com/yuba/items/a402cc00f7e1ce900e4b
max(end_date) keep (dense_rank last order by end_date nulls last)
case when count(case when end_date is null then 1 end) = 0 then max(end_date) end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment