表B里的字段AA值可能为空 也可能为如同这种字符串:1,4,5,2,22,11,6,3现在需要列出啊AA中有1的记录:是1不是11  我使用下面的语句为何不管用??ID="1";
sql += "where "+ID+" not in(AA)"

解决方案 »

  1.   

    select 
    case when concat(',',1,',') like 
    concat(',','1,4,5,2,22,11,6,3',',') then 123 else 456 end  as dd
      

  2.   

    字段AA值可能为空 也可能为如同这种字符串:1,4,5,2,22,11,6,3 
    我用
    Select * from mes where concat(',',"+ID+",',') not like concat(',',AA,',')
    可以实现但有个问题:如果AA值为NULL就失效了 列不出来了 请问如何实现??
      

  3.   

    concat(',',AA,',')->
    concat(',',COALESCE(AA.''),',')
      

  4.   


    concat(',',AA,',')->
    concat(',',COALESCE(AA,''),',')