select a.* b.* from a left join b 
on charindex('/'+cast(a.id as varchar)+'/','/+'b.idl
where a.id not null

解决方案 »

  1.   

    没写完
    select a.* b.* from a left join b 
    on charindex('/'+cast(a.id as varchar)+'/','/+'b.idl)>0
    where a.id not null
      

  2.   

    select * from 表b where '/'+列+'/' like '%/'+@参数+'/%'
      

  3.   

    出错不行
    Argument data type varchar is invalid for argument 3 of charindex function.
      

  4.   

    select a.* b.* from a left join b 
    on charindex('/'+cast(a.id as varchar)+'/','/+'b.idl)>0
    where a.id not null你肯定写错了,在:
    charindex('/'+cast(a.id as varchar)+'/','/+'b.idl)看看是不是多了逗号
      

  5.   

    select * from 表b where '/'+列+'/' like '%/'+(select 列 from 表a where 唯一编号=@条件)+'/%'不行吗???
      

  6.   

    select * from 表b where '/'+列+'/' like '%/'+(select 列 from 表a where 唯一编号=@条件)+'/%'
      

  7.   

    amtyuranus((看看)) 完全是拷贝一下,摆明是想骗点分呗!:)
      

  8.   

    我的代码是
    select b.* from b where 
    b.id1=charindex('|'+cast(a.id as char)+'|','/+'b.idl))
      

  9.   

    我说得详细些.表a有这样的一个字段id1
    id1 
    a
    b
    c
    d
    e
    表b有这样id字段,包含了a的id1字段,用|分开,但其中有些是id1中没有的.
    id             
    a|b|c|            
    a|c|
    b|
    d|f|
    请把表b的id中含有id1中没有的字段的记录找出来.如何?
      

  10.   

    各位的答案只能找出a.id中有的记录,却无法找出a.id中没有的记录.
      

  11.   

    http://expert.csdn.net/Expert/topic/1379/1379825.xml?temp=.6623651