ERP 입고 및 판매 가격 보고서

use Test
go
 SELECT 
  MOCTF.TF001+'-'+MOCTF.TF002 as       
 ,MOCTF.TF003 as     
 ,MOCTG.TG004 as   
 ,MOCTG.TG005 as   
 ,MOCTG.TG006 as   
 ,MOCTG.TG007 as   
 ,MOCTG.TG011 as   
 ,MOCTA.TA026+'-'+MOCTA.TA027+'-'+MOCTA.TA028 as     
 ,COPTD.TD011 as   
 ,COPTC.TC009 as    
 ,MOCTG.TG011*COPTD.TD011*COPTC.TC009 as   
FROM MOCTF  
 Left JOIN MOCTG On MOCTF.TF001=MOCTG.TG001 and MOCTF.TF002=MOCTG.TG002 
 Left JOIN MOCTA On MOCTG.TG014=MOCTA.TA001 AND MOCTG.TG015=MOCTA.TA002 
 Left JOIN COPTD On MOCTA.TA026=COPTD.TD001 AND MOCTA.TA027=COPTD.TD002 AND MOCTA.TA028=COPTD.TD003 AND MOCTA.TA006=COPTD.TD004  
 left join COPTC on TC001+TC002=TD001+TD002
 WHERE 
     MOCTF.TF006 = 'Y' 
     AND MOCTG.TG022 = 'Y' 
     and TF001 = '5804'  --    
     and TF003 like '201806%'  --    
     and COPTD.TD011 is not null   --  NULL

좋은 웹페이지 즐겨찾기