MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Joins in tables

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
prabhutp
Beginner


Joined: 02 Feb 2005
Posts: 20
Topics: 11

PostPosted: Mon Jun 13, 2005 4:44 am    Post subject: Joins in tables Reply with quote

Hi

I have used left outer join in my cursor for five different tables based on one table.I also have a need to fetch rows from the sixth table based on a field from the third table in the outer join.My query is can i include that equijoin also in the whole cursor or should i hav a different cursor...

Example

As of now the first cursor is
Code:

DECLARE DIC_FLD_CSR CURSOR WITH HOLD
FOR SELECT   
A.FLD_KEY
A.FLD_NAM
A.SHRT_COD
A.DEFN_TYP
A.TBL_KEY
A.FLD_DESC
A.DB2_COLN_NAM
A.DB2_FLD_POS_ST
A.DB2_FLD_POS_EN
A.DATA_ITEM_REF
A.FLD_XPSN
A.FLD_TYP
A. AGGR_WHR_CLAU
A. AGGR_OPER
B.DATA_ITEM_REF
B.DATA_ITEM_FMT   
B.DATA_ITEM_LGTH 
B.DATA_ITEM_DESC1
B.DATA_ITEM_DESC2
B.DATA_ITEM_DESC3
B.DATA_ITEM_DESC4
C. DATA_SRC_DESC
D.TXT_LINE_NO   
D.TXT_LINE_DEFN
E.IND_VSBL
FROM   SAM_DIC_FLD                                                      A
         
   LEFT OUTER JOIN SAM_DATA_ITEM             B
      ON A.DATA_ITEM_REF = B.DATA_ITEM_REF
   LEFT OUTER JOIN SAM_DATA_SRC               C
      ON A.DATA_SRC_CD = C.DATA_SRC_CD
   LEFT OUTER JOIN SAM_DIC_DEFN_TXT       D
      ON A.FLD_KEY = D.FLD_KEY
   LEFT OUTER JOIN SAM_DIC_TBL            E
      ON A.TBL_KEY = E.TBL_KEY      
ORDER BY    FLD_KEY ASCENDING


The second cursor is
Code:

DECLARE DATA_VAL_CSR CURSOR WITH HOLD
FOR SELECT   

VAL_LINE_NO
VAL_DESC
VAL_USER_OPR
VAL_USER_FROM
VAL_USER_TO
VAL_VALUE   
FROM   SAM_DATA_ITEM_VAL
WHERE   DATA_ITEM_REF = SAM392-DATA-ITEM-REF


Can we join these both cursors????

Kindly help
_________________
tp
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group