string abc="aa,bb,cc,";如何查询出id 在abc中的记录。

解决方案 »

  1.   

    我也是刚学会的
    select * from table where instr(','||abc||',',','||id||',')>0;
      

  2.   

    谢谢楼上的,我运行了一下,报错了。
    语句里有abc 这样不对吧
      

  3.   

    select * from table where 字段 in ('",abc,"')
      

  4.   

    你是在哪里运行的,我写的那个abc指的是你那个串
      

  5.   

    我这样写的:
    select * from T_table where instr(','||aa,bb,||',',','||ID||',')>0
      

  6.   

    select * from table where 字段 in ('",abc,"')这个也试了,不对
      

  7.   

    晕,这样啊
    那这样就行了
    select * from T_table where id in('aa','bb');
      

  8.   

    我的abc里面的字符是不一定的。没法写成你的那样
      

  9.   

    那样的化就把你的串存入变量abc,然后按我1楼那个执行
      

  10.   

    加入我的串就是aa,bb,cc,应该怎么写呢?
      

  11.   

    写成这样select * from T_table where instr(','||aa,bb,cc,||',',','||ID||',')>0 ????
      

  12.   

    string abc="aa,bb,cc,";
    上面那个不是把串已经放到abc里了吗,然后直接执行下面的,不要修改
    select * from table where instr(','||abc||',',','||id||',')>0;
      

  13.   

    select * from table
    where instr(id,'aa,bb,cc')>0