SELECT UPN.SETID , CST.SETID , CST.CUST_ID , UPN.UPN_TYPE_CD , IT.UPC_ID , UPN.UPN_ID , PC.PRODUCT_ID , PC.DESCR , MFG.MFG_ID , MFG.PREFERRED_MFG FROM PS_PRODCTLG_LST_VW PC , PS_ITEM_MFG_UPN_FS UPN , PS_PROD_UOM UOM , PS_CUST_SOLDTO_OPT CST , PS_ITEM_MFG MFG , PS_INV_ITEMS IT WHERE PC.SETID = UPN.SETID AND PC.SETID = UOM.SETID AND PC.SETID = CST.SETID AND PC.SOLD_TO_CUST_ID = CST.CUST_ID AND PC.PRODUCT_ID = UOM.PRODUCT_ID AND PC.PRODUCT_ID = UPN.INV_ITEM_ID AND UPN.UNIT_OF_MEASURE = UOM.UNIT_OF_MEASURE AND UPN.UPN_ID <> ' ' AND UPN.UPN_TYPE_CD = CST.UPN_TYPE_CD AND %EffdtCheck(CUST_SOLDTO_OPT CST2, CST, %CurrentDateIn) AND %Join(COMMON_KEYS, ITEM_MFG MFG, ITEM_MFG_UPN_FS UPN) AND PC.PRODUCT_ID = ( SELECT MIN(PROD2.PRODUCT_ID) FROM PS_PROD_ITEM PROD2 , PS_ITEM_MFG_UPN_FS UPN2 , PS_PROD_UOM UOM2 WHERE PROD2.SETID = PC.SETID AND PROD2.SETID = UPN2.SETID AND UOM2.SETID = PROD2.SETID AND UOM2.PRODUCT_ID = PROD2.PRODUCT_ID AND UOM2.PRODUCT_ID = PC.PRODUCT_ID AND UOM2.UNIT_OF_MEASURE = UOM.UNIT_OF_MEASURE AND UPN2.UNIT_OF_MEASURE = UPN.UNIT_OF_MEASURE AND UPN2.UPN_ID = UPN.UPN_ID) AND PC.EFF_STATUS = 'A' AND IT.SETID = MFG.SETID AND IT.INV_ITEM_ID = MFG.INV_ITEM_ID AND IT.UPC_ID > ' '
|