How to use less than equal in MyBatis 3.
<select id="getLog" resultMap="BaseResultMap" parameterType="java.lang.String">
SELECT * FROM(
SELECT * FROM TABLE1
WHERE COL1 =#{COL1,jdbcType=VARCHAR}
ORDER BY DATE DESC
) TABLE2
WHERE ROWNUM <= 20
</select>
I show examples for the Greater Than/Equal Operator and the Less Than/Equal Operators:
ROWNUM >= 20
ROWNUM <= 20
Or, for readability, you can wrap them in CDATA
ROWNUM <![CDATA[ >= ]]> 20
ROWNUM <![CDATA[ <= ]]> 20
Use CDATA
to escape "<" similar like xml.
<select id="getLog" resultMap="BaseResultMap" parameterType="java.lang.String">
SELECT * FROM(
SELECT * FROM TABLE1
WHERE COL1 =#{COL1,jdbcType=VARCHAR}
ORDER BY DATE DESC
) TABLE2
WHERE ROWNUM <![CDATA[ <= 20 ]]>
</select>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With