try:
Select * from table1, table2 where table1.value like '%test%' 
and charindex((Select top 1 category from table1 where value like '%test%' ),table2.CATIDs) > 0

解决方案 »

  1.   

    Select * from table1, table2 where ','+table2.CATIDs+',' like '%,'+rtrim(table1.Category)+',%'
      

  2.   

    Select * from table1, table2 where ','+table2.CATIDs+',' like '%,'+rtrim(table1.Category)+',%'
      

  3.   

    try:
    Select * from table1, table2 where table1.value like '%test%' and 
    charindex(table1.Category,table2.CATIDs)>0
      

  4.   

    Select * from table1, table2 where table1.value like '%test%' and table2.CATIDs like '%,'+cast(table1.Category as varchar(10))+',%'
      

  5.   

    Select * from table1, table2 where table1.value like '%test%' and ','+table2.CATIDs+',' like '%,'+cast(table1.Category as varchar(10))+',%'
      

  6.   

    Select * from table1, table2 where table1.value like '%test%' and 
    charindex(rtrim(cast(table1.Category as varchar(10))),table2.CATIDs)>0
      

  7.   

    如果你的table2.CATIDs数据是:'324,234,56'
    你要改为:   Select * from table1, table2 where table1.value like '%test%' and ','+table2.CATIDs+',' like '%,'+cast(table1.Category as varchar(10))+',%'
      

  8.   

    Select * from table2 where CATIDs in (Select cast(category as varchar(30)) from table1 where value like '%test%')
      

  9.   

    这么短时间就有这么多回复,真是太感动了!!!! 非常感谢各位,我现在马上逐个试试,成功后就散分!//bow