开发者

update column by row number

开发者 https://www.devze.com 2023-01-15 08:55 出处:网络
I have one table that contain lots of records and I want to update my primary key开发者_运维技巧 by row number. My database is MySQL.You shouldn\'t do that.

I have one table that contain lots of records and I want to update my primary key开发者_运维技巧 by row number. My database is MySQL.


You shouldn't do that.
There is not a thing called "row number" in the database.
Such a number can be applicable only to output of certainly ordered and filtered data, but not to stored one.

Leave your primary key alone, it identifies the whole record, not it's "position" (especially because there is no position at all).

Why do you need that? Your task has another solution for sure, a proper one


mysql isn't Oracle and doesn't support rownum.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号