日期:2014-05-17 浏览次数:20693 次
select distinct gx.GXMXID,LStationID,gx.GXID1 as GXID,gx.ZhuanYeID,LeiXingID1 as LeiXingID,LeiXingMingChen1 as LeiXingMingChen,GXWCShiJian as TopTime,
(dbo.f_JianLianCompleteInfo('KDDG00001890',LeiXingID1,104)) as IsFinish
FROM #tmp gx left join SF_GXShangChuan a on gx.GXMXID=a.GXMXSID and (LStationID is null or LStationID = 'KDDG00001890')
where TomComID1 is null and gx.ZhuanYeID=104 --and (LStationID is null or LStationID = 'KDDG00001890')
select distinct LStationID,gx.GXID1 as GXID,gx.ZhuanYeID,LeiXingID1 as LeiXingID,LeiXingMingChen1 as LeiXingMingChen,GXWCShiJian as TopTime,
(case when GXWCShiJian is not null and FinishContent=3 then 1 else 0 end) as IsFinish
FROM #tmp gx left join SF_GXShangChuan a on gx. GXMXID=a.GXMXSID
where TomComID1 is null and gx.ZhuanYeID=104 and (LStationID is null or LStationID = 'KDDG00001890')
--这个还是left join
select *
from a
left join b
on a.id = b.id and b.xxx = 'xxx'
--这个就是转化为inner join
select *
from a
left join b
on a.id = b.id
where b.xxx = 'xxx'