subquery has "order by" don't work in mybatis

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

subquery has "order by" don't work in mybatis

Kun David
SQL: select * from (select * from t1 order by id desc)AS t2   is working in mysql.
but in mybatis is not work.

<select id ="queryId" , resultMap="">
   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.
Reply | Threaded
Open this post in threaded view
|

Re: subquery has "order by" don't work in mybatis

Kazuki Shimizu
Could you provide reproduce project on GitHub ?

On Tuesday, August 15, 2017 at 9:07:28 PM UTC+9, Kun David wrote:
SQL: select * from (select * from t1 order by id desc)AS t2   is working in mysql.
but in mybatis is not work.

<select id ="queryId" , resultMap="">
   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.