Thursday, July 30, 2015

SQL to find All Records under a specified component


 SELECT DISTINCT RECNAME FROM PSRECDEFN
     WHERE (    RECNAME IN (SELECT RECNAME FROM PSPNLFIELD WHERE PNLNAME IN (SELECT DISTINCT B.PNLNAME
                FROM PSPNLGROUP A, PSPNLFIELD B WHERE (A.PNLNAME = B.PNLNAME OR A.PNLNAME = B.SUBPNLNAME)
                 AND A.PNLGRPNAME = 'JOB_DATA'))
             OR RECNAME IN (SELECT RECNAME FROM PSPNLFIELD WHERE PNLNAME IN (SELECT DISTINCT B.SUBPNLNAME
                FROM PSPNLGROUP A, PSPNLFIELD B WHERE (A.PNLNAME = B.PNLNAME OR A.PNLNAME = B.SUBPNLNAME)
                AND A.PNLGRPNAME = 'JOB_DATA'))
           )

No comments:

Post a Comment