也就是在后面的个条件中加上 find_in_set(userid,'81,82') 

解决方案 »

  1.   

    userid 是你查出来的字段赋值的别名 
    SQL执行步骤中,where在select前面,所以不可能在where中使用不存在的别名
    你可以在外面加一层查询,使用findinset就可以了
      

  2.   

    select * from (select * , ( select owner from terminal where terminal.id = terminalinfo.terminal limit 1 ) as userid from terminalinfo where InfoType > 2) A where find_in_set(userid,'81,82') > 1这样就可以了 而且你的 find_in_set 好像没给条件吧
      

  3.   

     select ( select * , ( select owner from terminal where terminal.id = terminalinfo.terminal limit 1 ) as userid from terminalinfo where InfoType > 2 ) where find_in_set(userid,'81,82') ; 
    这样写不对.
      

  4.   


    可以了,谢谢,有个条件啊,find_in_set 的条件就是 userid 在后面这几个值中间.
      

  5.   

    FIND_IN_SET(str,strlist)
    假如字符串str 在由N 子链组成的字符串列表strlist 中, 则返回值的范围在 1 到 N 之间 。一个字符串列表就
    是一个由一些被‘,’符号分开的自链组成的字符串。如果第一个参数是一个常数字符串,而第二个是type
    SET列,则   FIND_IN_SET() 函数被优化,使用比特计算。如果str不在strlist 或strlist 为空字符串,则返回值
    为 0 。如任意一个参数为NULL,则返回值为 NULL。 这个函数在第一个参数包含一个逗号(‘,’)时将无法正常运
    行。 
      

  6.   


    那你改成 find_in_set(userid,'81,82') > 0 刚才写错了
    要不就是 find_in_set(userid,'81,82') >= 1