mybatis动态sql可以操作sql查询到的数据吗?
Mybatis可以用“if”和“foreach”来操作输入参数数据,但是在同一个Mybatis sql中刚刚查询的数据呢?
案例:
桌子 场地 1
从表中选择字段; 将得到 1
Mybatis 可以通过这种语句将字段更新为 2 吗? :
<update id="updateField">
select field from table;
<if test="field != 0 ">
update table
set field = 2
where field = 1;
</if>
<update>
Mybatis can operate input parameters data with "if" and "foreach", but how about the data just queried within same Mybatis sql?
case:
table
field
1
select filed from table;
will get 1
Can Mybatis manage to update field to 2 with this kind of statement? :
<update id="updateField">
select field from table;
<if test="field != 0 ">
update table
set field = 2
where field = 1;
</if>
<update>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论