数据库是MySQL,语句是 select * from TableName where BH_CBDW in({user_corpId});请问MySQL里有这样的语法吗?in里面加上花括号 字段名? 我执行不过去,提示语法错误。

解决方案 »

  1.   

    select * from TableName where BH_CBDW in(user_corpId);
      

  2.   

    额~~~这里是SQLServer专区,不过这个语法在SQLServer是会报错的,不说要不要花括号,但是最起码in里面不能用字段,最少in里面要用select 字段 from 表
      

  3.   

    在SQL里面,这么写不行的。select * from TableName where BH_CBDW in(select user_corpId from other_tb where ...)
      

  4.   

    MySQL语法中,in后面也是跟上(),这个和SQL语法是一样的。语句是 select * from TableName where BH_CBDW in({user_corpId});{user_corpId}这个只是告诉你,以后换个具体的字段名。举例的话就和1楼和3楼的一样
      

  5.   

    user_corpId是数组?
    如果是多个内容,用字符串累加生成SQL语句,再动态执行
      

  6.   

    ---mysql不允许{}
    select * from TableName where BH_CBDW in(user_corpid);
      

  7.   

    MYSQL中没有这种 {} 语法。 SQL SERVER中同样没有。