Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------------------------
- | CD | stg_cd |
- ------------------------------
- | APDN_82 | CUSC |
- | APDN_82 | CUC |
- ------------------------------
- ------------------------------
- | stg_cd | srt_ordr |
- ------------------------------
- | CUSC | 1 |
- | KLD | 3 |
- | CUC | 2 |
- ------------------------------
- ------------------------------
- | CD | stg_cd |
- ------------------------------
- | APDN_82 | CUC |
- ------------------------------
- (SELECT * FROM tableA AS A
- WHERE A.ID = 'APDN_82' AND A.stg_cd
- IN (SELECT lead('CUSC') over (order by B.srt_ordr) from tableB AS B)
Add Comment
Please, Sign In to add comment