原来在oracle下执行没问题 现在每次到下面这句查询就Exception 我把语句拿到mysql中可以正常执行,请教各位?select distinct RESID from BASE_ROLE_RESOURCES where ROLEID='34';
07:49:40,750 DEBUG DebugLog:194 - Ajax调用处理后FormBean{rolename=4, msg=com.exp.dao.EXPSQLException: com.exp.dao.EXPSQLException:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where ROLEID='34'' at line 1

解决方案 »

  1.   

    从报错来看应该就是  'where ROLEID='34'' 这里有错误
    ROLEID 是int 还是varchar?是int型就这样子写
    select distinct RESID from BASE_ROLE_RESOURCES where ROLEID=34;
      

  2.   


    select distinct RESID from BASE_ROLE_RESOURCES where ROLEID='34'; 你ID不是int么??是int的话 就 ROLEID=34 
    再一个就是说你ID不是唯一标识符?  既然指定了id=34  还要用distinct?
      

  3.   

    我赞同楼上的说法 既然是唯一的标示那么 还用distinct排除相同的行 干什么?还有‘34’那是字段为varchar时用的既然是int那么就直接34就可以了
      

  4.   

    谢谢各位,由于框架比较复杂,经过后来仔细检查,发现原来是另一处where ROLEID='34'的delete语句漏写了from