1. 程式人生 > >mysql sql語句update操作

mysql sql語句update操作

1.修改 

示例

update t_dinner_order set del_flag = 1 ,update_by = #{signUp.updateBy.id},update_date =#{signUp.updateDate} 
        where teacher_id = #{signUp.teacher.id}
        and dinner_date in 
       <foreach collection="list" item="item" index="index"  open="(" close=")" separator=",">  
            #{item}
        </foreach>

2.修改多表

示例

UPDATE t_select_enlist see
        INNER JOIN t_select_course scc
        ON see.belong_to = scc.id
        SET see.del_flag = '1'
        WHERE see.del_flag = '0' AND scc.del_flag = '0' AND scc.group_id = #{groupId} 
        AND see.student_id = #{studentId}