34,590
社区成员
发帖
与我相关
我的任务
分享
select (case when(select top 1 c.supply from material c where a.mtl=c.materialname)is null then '' else (select top 1 c.supply from material c where a.mtl=c.materialname) end) as SUPPLy,a.mtl,b.id from #temptab1 b left join package a on b.id=a.id where b.id=a.id and len(a.mtl)>0
-->try
select SUPPLy=(select top 1 isnull(c.supply,'') from material c where a.mtl=c.materialname),a.mtl,b.id
from #temptab1 b
inner join package a
on b.id=a.id and len(a.mtl)>0