with t1 as ( select 'reb' as type, 1 as poss, 1 as ord, 'nick' as name union all select 'reb' as type, 1 as poss, 2 as ord, null as name union all select 'shot' as type, 1 as poss, 3 as ord, 'tom' as name union all select 'reb' as type, 1 as poss, 4 as ord, null as name union all select 'shot' as type, 1 as poss, 5 as ord, 'bil' as name union all select 'reb' as type, 2 as poss, 1 as ord, null as name union all select 'reb' as type, 2 as poss, 2 as ord, null as name union all select 'shot' as type, 2 as poss, 3 as ord, 'joe' as name union all select 'reb' as type, 2 as poss, 4 as ord, 'tim' as name union all select 'shot' as type, 2 as poss, 4 as ord, 'tim' as name )
select First_value(if(type='shot', name, null) ignore nulls) over(partition by poss order by poss) as firstname,* from t1