Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Type1 Time1 Type2 Time2 Type3 Time3
- Linehaul 3 Trans 2 Sort 1
- Trans 5 Sort 2 Linehaul 2
- Type1 time1 Type2 time2 Type3 time3 Trans time for sort
- Linehaul 3 Trans 2 Sort 1 1
- Trans 5 Sort 2 Linehaul 2 2
- with tab as(
- select 'Linehaul' as c1, 3 as val1, 'Trans'as c2, 2 as val2, 'Sort' as c3, 1 as val3 from dual union all
- select 'Trans', 5, 'Sort', 2 , 'Linehaul', 2 from dual
- )
- select t.*
- ,case
- when t.c1 = 'Sort' then val1
- when t.c2 = 'Sort' then val2
- when t.c3 = 'Sort' then val3
- else -1
- end as X
- from tab t
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement