SELECT mtr_mst.site_cd,   
			mtr_mst.mtr_mst_mtr_no,			 
			mtr_mst.mtr_mst_costcenter,   
			mtr_mst.mtr_mst_account,  
			mtr_mst_assetno  =coalesce(mtr_mst_assetno, ''),
			mtr_mst_wo_no =coalesce(mtr_mst_wo_no, ''),
			mtr_mst.mtr_mst_mr_status,			
			mtr_mst.mtr_mst_org_date,    
			mtr_mst.mtr_mst_req_date,
			mtr_mst.mtr_mst_requester,			
			Requester_Name = coalesce(  (	SELECT 	emp_mst_2.emp_mst_name
										FROM		emp_mst (NOLOCK) emp_mst_2
										WHERE	emp_mst_2.site_cd = mtr_mst.site_cd
										AND		emp_mst_2.emp_mst_empl_id = mtr_mst.mtr_mst_requester ), ''),
										
		mtr_mst.RowID
FROM 	mtr_mst (NOLOCK)
WHERE  ( mtr_mst.site_cd = 'SILK')
								 AND mtr_mst_status IN ('W', 'A', 'N', 'L') AND ( RowID IN ( SELECT mst_RowID FROM mtr_ls1 WHERE mtr_mst.site_cd = mtr_ls1.site_cd AND mtr_ls1_bo_qty > 0  )) 
								 AND mtr_mst_wo_no IS NOT NULL  								
								 UNION ALL  
								 SELECT mtr_mst.site_cd,   
										mtr_mst.mtr_mst_mtr_no,			 
										mtr_mst.mtr_mst_costcenter,   
										mtr_mst.mtr_mst_account,  
										mtr_mst_assetno  =coalesce(mtr_mst_assetno, ''),
										mtr_mst_wo_no =coalesce(mtr_mst_wo_no, ''),
										mtr_mst.mtr_mst_mr_status,			
										mtr_mst.mtr_mst_org_date,    
										mtr_mst.mtr_mst_req_date,
										mtr_mst.mtr_mst_requester,			
										Requester_Name = coalesce(  (	SELECT 	emp_mst_2.emp_mst_name
																		FROM		emp_mst (NOLOCK) emp_mst_2
																		WHERE	emp_mst_2.site_cd = mtr_mst.site_cd
																		AND		emp_mst_2.emp_mst_empl_id = mtr_mst.mtr_mst_requester ), ''),
										mtr_mst.RowID
								 FROM 	mtr_mst 
								 WHERE ( mtr_mst.site_cd = 'SILK')
								 AND mtr_mst_status IN ('W', 'A', 'N', 'L') AND ( RowID IN ( SELECT mst_RowID FROM mtr_ls1 WHERE mtr_mst.site_cd = mtr_ls1.site_cd AND mtr_ls1_bo_qty > 0  )) 
								 AND mtr_mst_wo_no IS NULL 