Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例:
3つの異なる数値があります。
1 2 3
1と3を残して2を削除します。3が2になるように番号を変更するにはどうすればよいですか?
1 3-> 1 2
私はたくさんの番号を持っているので、1つずつではなく一度に変更したいと思います。それにはかなりの時間がかかります。ありがとうございました!
それらが単純な位置コードであり、あなたが望むなら
delete from mytable where position=2 update mytable set position=position-1 where position>2
それらが何かのIDである場合、関連する可能性のあるテーブルに対して多くの更新を行うため、これは悪いことです。