WITH data as (
select 'jake' as name, 18 as age
union all
select 'tom' as name, 64 as age
union all
select 'lisa' as name, 32 as age
union all
select 'justin' as name, 43 as age
)
select
-- max_by(name, age) as name
max(named_struct('age',age,'name',name)).name as name
from
data;
Created
November 22, 2019 09:59
-
-
Save myui/119526f4ede7793c3f9b271cbe3a8a80 to your computer and use it in GitHub Desktop.
max_by.sql
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment