在mybatis里 select 子表的时候 里面有 order by的话 mybatis 报错。

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

在mybatis里 select 子表的时候 里面有 order by的话 mybatis 报错。

Kun David
SQL: select * from (select * from t1 order by id desc)AS t2   这样的语句在mysql是工作的
但是在mybatis里的xml的语句就不行。

<select id ="queryId" , resultMap="XXX">
   select * from (
       select * from t1
     order by id desc
    ) AS t2
</select>


Err:

 Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 '' at line 27

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.