Guest User

Untitled

a guest
Dec 14th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. ------------------------------
  2. | CD | stg_cd |
  3. ------------------------------
  4. | APDN_82 | CUSC |
  5. | APDN_82 | CUC |
  6. ------------------------------
  7.  
  8. ------------------------------
  9. | stg_cd | srt_ordr |
  10. ------------------------------
  11. | CUSC | 1 |
  12. | KLD | 3 |
  13. | CUC | 2 |
  14. ------------------------------
  15.  
  16. ------------------------------
  17. | CD | stg_cd |
  18. ------------------------------
  19. | APDN_82 | CUC |
  20. ------------------------------
  21.  
  22. (SELECT * FROM tableA AS A
  23. WHERE A.ID = 'APDN_82' AND A.stg_cd
  24. IN (SELECT lead('CUSC') over (order by B.srt_ordr) from tableB AS B)
Add Comment
Please, Sign In to add comment