'Can mybatis dynamic sql operate data queried from sql?

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>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source