日期:2014-05-17 浏览次数:20446 次
select JO026,* FROM [dbo].[APSJOB] where JO015 IN (SELECT RE002 FROM APSRES WHERE RE001 = 'liyu')
select * FROM [dbo].[APSJOB] where JO015 IN CASE WHEN JO026 = '0' THEN (SELECT RE002 FROM APSRES WHERE RE001 = 'liyu') ELSE (SELECT DISTINCT RE002 FROM APSRES ) END
select case when JO015 IN (SELECT RE002 FROM APSRES WHERE RE001 = 'liyu') then '0' else '1' end as JO026,* from [dbo].[APSJOB]
------解决方案--------------------
select JO026,* FROM [dbo].[APSJOB] where (isnull(JO026,'0') = '0' and JO015 IN (SELECT RE002 FROM APSRES WHERE RE001 = 'liyu')) or JO026='1'