SELECT BUSINESS_UNIT ,SP_REQ_ID ,LINE_NBR ,C.LOCATION ,SHIPTO_ID ,A.DESCR FROM PS_SHIPTO_TBL A , PSTREELEAF B ,PS_SPF_REQ_LINE C ,PS_LOCATION_TBL D , PS_SET_CNTRL_GROUP S WHERE A.SETID=D.SETID AND A.SHIPTO_ID=D.LOCATION AND C.BUSINESS_UNIT = S.SETCNTRLVALUE AND S.REC_GROUP_ID = 'SP_01' AND B.SETID = S.SETID AND SHIPTO_ID BETWEEN RANGE_FROM AND RANGE_TO AND TREE_NAME ='REGION_TREE' AND TREE_NODE_NUM =( SELECT DISTINCT TREE_NODE_NUM FROM PSTREELEAF F WHERE C.LOCATION BETWEEN RANGE_FROM AND RANGE_TO AND TREE_NAME ='REGION_TREE' AND F.SETID = S.SETID)
|