i have table like this
-----------------------
id | name | is_default|
------------------------
1 | a | 1 |
2 | a | 0 |
3 | a | 0 |
4 | a | 0 |
-----------------------
now i want to change line 2(id =2) is_default to 1,and origin line(id =1) id_default to 0 at the same time,like the choose default option in list in UI. 1.can i do this in one sql statement? 2.if it is possible,how to write the sql statement or how to write in mybatis mapper.xml?
Springboot with mybatis ,sql statement write in mapper.xml
@Data
pulbic class Option{
private Integer id;
private String name;
private Boolean isDefault;
}
how to write the mybatis or mysql statement?