mysql  select *... where id  in (select 字符串 from ... )问题?其中字符串的内容是'12,11,10,4';如何才能让内容成为12,11,10,4

解决方案 »

  1.   

    没有理解你的的意思
    select *... where id IN(12,11,10,4)?
      

  2.   

    select *... where id IN(12,11,10,4)我想要成这样,但出现的是select *... where id IN(‘12,11,10,4’)出现的结果只人一条ID=12的
      

  3.   

    select * from upfiles where id in( SELECT picture FROM msg where id=77 );
    SELECT picture FROM msg where id=77 结果为:'12,11,10,4'
    select * from upfiles where id in( SELECT picture FROM msg where id=77 )结果为:12
      

  4.   

    select instr((select picture from upfiles where id=77),'12')
    测试一下,准确的要两头加逗号
      

  5.   

    select * from upfiles where id in( SELECT picture FROM msg where id=77 )
    我想要的结果是:4条记录
    12 及其内容
    11 及其内容
    10 及其内容
    4  及其内容
      

  6.   

    没有记录无法测试,
    select instr((select picture from upfiles where id=77),'12')
    测试没有
      

  7.   

    我觉得,in 是在同一行的字符之间的。
    SELECT picture FROM msg where id=77 结果为:'12,11,10,4' 是一个结果集,其实是4行,因此每次只能取得第一行的值。
    不知道是不是这个原因
      

  8.   

    mssql 中有这个功能,mysql'12,11,10,4' 去掉''就可以
      

  9.   

    如果是要把 '12,11,10,4' 转换成能让in用的4个值,我没有想出什么好方法。
    1 处理字符串 分别把12 11 10 4 赋值给不同的整形数
    2 使用预处理重新生成 select ...in... 这个句子
      

  10.   

    用这个语句是完全可以的
    select instr((select picture from upfiles where id=77),id) from tt
      

  11.   

    select * from ttu
    where instr((select id1 from tth where id=1),id)>0
    测试通过
      

  12.   

    Write a function to split it into single number.This is very simple.
      

  13.   

    select * from tables where id in(select id from tables1 where 条件='')
      

  14.   

    select * from t_car where instr("12,11,10,4",car_id)>0
      

  15.   


    试试这句
    select *... where id IN ('12,11,10,4') group by id
      

  16.   

    前后加“,”再instr
    如:
    todept=12,11,10,4';
    select * from table1 where instr(concat(",",todept,","),concat(",",id,","))>0;
      

  17.   

    select * from upfiles where id in({'12,11,10,4'});我碰到过类似的问题,格式可能有点问题,我遇到的是SELECT * FROM books WHERE id in ({boIDs});我给的不一定对,你可以试试。
      

  18.   

    select * from upfiles where find_in_set(id,(SELECT picture FROM msg where id=77));
    这种方式可以解决这问题。