日期:2014-05-18 浏览次数:20653 次
select b.* from tbb b
inner join tba a
on b.code like a.code + '%'
where 你的其它条件,没有就不要了
------解决方案--------------------
like 还可以改为 charindex,patindex等,所以组合的写法有n(n>10)种 ,这里就不写了。
------解决方案--------------------
--TRY
select b.code,b.uname from tbb b ,tba a where patindex('%'+ltrim(b.code)+'%',ltrim(a.code))>0
------解决方案--------------------
select b.* from tbB b right join tbA a on charindex(a.code,b.code)=1 where 其他条件