SELECT DISTINCT A.FIELDNAME ,'' , C.LONGNAME FROM PS_PV_WSRULE_SETUP A , PSPTSF_SD_ATTR B , PSDBFLDLABL C WHERE B.PTSF_SBO_NAME IN ('EP_PV_MASTERITEMVENDOR_SD','EP_PV_MASTERITEM_SD') AND B.PTSF_SRCATTR_NAME=A.FIELDNAME AND A.FIELDNAME=C.FIELDNAME AND C.DEFAULT_LABEL=1 AND NOT EXISTS ( SELECT 'X' FROM PS_PV_WSRULE_SETUP A1 , PSPTSF_SD_ATTR B1 , PSDBFLDLABL C1 WHERE B1.PTSF_SBO_NAME IN ('EP_PV_MASTERITEMVENDOR_SD','EP_PV_MASTERITEM_SD') AND B1.PTSF_SRCATTR_NAME<>A1.FIELDNAME AND A1.FIELDNAME=%Substring(B1.PTSF_SRCATTR_NAME,1,LENGTH(A1.FIELDNAME)) AND A1.FIELDNAME=C1.FIELDNAME AND C1.LABEL_ID= %Substring(B1.PTSF_SRCATTR_NAME,LENGTH(A1.FIELDNAME)+2 ,LENGTH(B1.PTSF_SRCATTR_NAME)) AND A.FIELDNAME=A1.FIELDNAME AND B.PTSF_SBO_NAME<>B1.PTSF_SBO_NAME) UNION SELECT DISTINCT A2.FIELDNAME , C2.LABEL_ID , C2.LONGNAME FROM PS_PV_WSRULE_SETUP A2 , PSPTSF_SD_ATTR B2 , PSDBFLDLABL C2 WHERE B2.PTSF_SBO_NAME IN ('EP_PV_MASTERITEMVENDOR_SD','EP_PV_MASTERITEM_SD') AND B2.PTSF_SRCATTR_NAME<>A2.FIELDNAME AND A2.FIELDNAME=%Substring(B2.PTSF_SRCATTR_NAME,1,LENGTH(A2.FIELDNAME)) AND A2.FIELDNAME=C2.FIELDNAME AND C2.LABEL_ID= %Substring(B2.PTSF_SRCATTR_NAME,LENGTH(A2.FIELDNAME)+2 ,LENGTH(B2.PTSF_SRCATTR_NAME)) AND NOT EXISTS ( SELECT 'X' FROM PS_PV_WSRULE_SETUP A3 , PSPTSF_SD_ATTR B3 , PSDBFLDLABL C3 WHERE B3.PTSF_SBO_NAME IN ('EP_PV_MASTERITEMVENDOR_SD','EP_PV_MASTERITEM_SD') AND B3.PTSF_SRCATTR_NAME=A3.FIELDNAME AND A3.FIELDNAME=C3.FIELDNAME AND C3.DEFAULT_LABEL=1 AND A2.FIELDNAME=A3.FIELDNAME AND B2.PTSF_SBO_NAME<>B3.PTSF_SBO_NAME) AND NOT EXISTS ( SELECT 'X' FROM PS_PV_WSRULE_SETUP A4 , PSPTSF_SD_ATTR B4 , PSDBFLDLABL C4 WHERE B4.PTSF_SBO_NAME IN ('EP_PV_MASTERITEMVENDOR_SD','EP_PV_MASTERITEM_SD') AND B4.PTSF_SRCATTR_NAME<>A4.FIELDNAME AND A4.FIELDNAME=%Substring(B4.PTSF_SRCATTR_NAME,1,LENGTH(A4.FIELDNAME)) AND A4.FIELDNAME=C4.FIELDNAME AND C4.LABEL_ID= %Substring(B4.PTSF_SRCATTR_NAME,LENGTH(A4.FIELDNAME)+2 ,LENGTH(B4.PTSF_SRCATTR_NAME)) AND A2.FIELDNAME=A4.FIELDNAME AND B2.PTSF_SBO_NAME<>B4.PTSF_SBO_NAME AND B2.PTSF_SRCATTR_NAME<>B4.PTSF_SRCATTR_NAME)
|