select * from a,c where rtrim(a.b) like '%'+rtrim(c.d)

解决方案 »

  1.   

    select a.* from a,c where ltrim(c.d) like '%'+ltrim(a.b)
      

  2.   

    select * from a,c where rtrim(a.b) like '%'+rtrim(ltrim(c.d))
      

  3.   

    ---测试数据---
    if object_id('[a]') is not null drop table [a]
    go
    create table [a]([b] int)
    insert [a]
    select 253
    if object_id('[c]') is not null drop table [c]
    go
    create table [c]([d] int)
    insert [c]
    select 53
     
    ---查询---
    select a.* from a,c where charindex(ltrim(c.d),ltrim(a.b))>0select a.* from a,c where ltrim(a.b) like '%'+ltrim(c.d)---结果---
    b           
    ----------- 
    253(所影响的行数为 1 行)
      

  4.   

    在SQL2005中试了楼主的查询语句可以啊!