日期:2014-05-19  浏览次数:20593 次

求一个sql
两个表tb1和tb2
tb1.a1是一个char
tb2.a1是int

我需要找的是tb1.a1中前8位中包含有tb2.a1的数据

比如
tb1.a1=00200
tb2.a1=2
就是我要的了

谢谢

------解决方案--------------------
select * from tb1,tb2 where charindex(rtrim(tb2.a1),left(tb1.a1,8))> 0