SHARE
TWEET

Untitled

a guest Jun 20th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Type1       Time1     Type2    Time2    Type3      Time3
  2. Linehaul    3        Trans      2       Sort       1
  3. Trans       5        Sort       2       Linehaul   2
  4.      
  5. Type1       time1    Type2  time2   Type3     time3    Trans time for sort
  6. Linehaul    3        Trans  2       Sort      1         1
  7. Trans       5        Sort   2       Linehaul  2         2
  8.      
  9. with tab as(
  10.   select 'Linehaul' as c1,   3 as val1,  'Trans'as c2,      2 as val2,       'Sort' as c3,       1 as val3  from dual union all
  11.   select 'Trans',       5,        'Sort',       2 ,      'Linehaul',   2   from dual
  12.  
  13. )
  14. select t.*
  15.       ,case
  16.         when t.c1 = 'Sort' then val1
  17.         when t.c2 = 'Sort' then val2
  18.         when t.c3 = 'Sort' then val3
  19.         else -1
  20.           end as X
  21. from tab t
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top