mardi 5 juillet 2016

Aggregation record with left outer join

I want to aggregate records between two table e.g. below I've tried left outer join with TB_SRS_MST table but I'm getting the desired result. Basically I want to show "-" for every series not exist in TB_DLR_STS table.

TB_DLR_STS TABLE

 DLR_CD  SRS_CD   STS
    D1    S1        Y
    D1    S2        N
    D2    S2        Y
    D2    S3        Y
    D3    S1        N

TB_STS_MST TABLE

SRS_CD  
  S1    
  S2    
  S3    
  S4    

DESIRED OUTPUT

DLR_CD  SRS_CD  STS
D1      S1      Y
D1      S2      N
D1      S3      -
D1      S4      -
D2      S1      -
D2      S2      Y
D2      S3      Y
D2      S4      -
D3      S1      N
D3      S2      -
D3      S3      -
D3      S4      -

Aucun commentaire:

Enregistrer un commentaire