[英]MySQL Increment Insert and Update Column
我有一個包含以下表字段的數據庫:
id no letter content
1 1 book
2 2 pen
3 3 a apple
4 3 b mango
5 3 c banana
6 4 car
我將插入id=7, no=2, letter=null and content=moon
新值。 我的問題是 mysql 將如何插入和更新命令“否”列,以便查詢結果變為:?
no letter content
1 book
2 moon
3 pen
4 a apple
4 b mango
4 c banana
5 car
update table
set no = no + 1
where no >= 2
and id != 7
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.