SELECT A.PNLGRPNAME , A.ITEMLABEL FROM PSMENUITEM A , PS_EODP_COMPDETREF B WHERE A.PNLGRPNAME = B.PNLGRPNAME AND A.MENUNAME = B.MENUNAME AND A.MARKET = B.MARKET AND A.MARKET = ( SELECT MIN(MARKET) FROM PSMENUITEM A1 WHERE A.MENUNAME = A1.MENUNAME AND A.BARNAME = A1.BARNAME AND A.ITEMNAME = A1.ITEMNAME ) UNION SELECT A.PNLGRPNAME , A.ITEMLABEL FROM PSMENUITEM A , PS_EODP_COMP_REF B WHERE A.PNLGRPNAME = B.PNLGRPNAME AND A.MARKET = ( SELECT MIN(MARKET) FROM PSMENUITEM A1 WHERE A.MENUNAME = A1.MENUNAME AND A.BARNAME = A1.BARNAME AND A.ITEMNAME = A1.ITEMNAME ) AND NOT EXISTS ( SELECT 'X' FROM PS_EODP_COMPDETREF C1 WHERE B.PNLGRPNAME = C1.PNLGRPNAME )
|