日期:2014-05-18 浏览次数:20582 次
SELECT CASE WHEN fvendinvc LIKE 'S%' AND len(fvendinvc)= 18 THEN fitemno ELSE fitemno_b END AS fitemno FROM por_inv
------解决方案--------------------
select (case when left(dbo.invdtf.fvendinvc,1)='S' then dbo.invdtf.fitemno else dbo.porecf_porlsf.fitemno end) AS fitemno, dbo.invdtf.fwhcd, dbo.invdtf.flotno2, dbo.invdtf.flotno, dbo.invdtf.fcoilno1, dbo.invdtf.fvendinvc, dbo.porecf_porlsf.mfcoilno1 FROM dbo.invdtf RIGHT OUTER JOIN dbo.porecf_porlsf ON dbo.invdtf.fcoilno1 = dbo.porecf_porlsf.mfcoilno1
------解决方案--------------------
CASE WHEN fvendinvc LIKE 'S%' AND len(fvendinvc)= 18 THEN fitemno ELSE fitemno_b END AS fitemno