troubleshooting Question

How to update MySQL table in reverse order?

Avatar of paulc2000
paulc2000 asked on
SQL
2 Comments1 Solution1633 ViewsLast Modified:
Hi All,

Say I have a table like this:

ROWID(unique)  NAME
1  JAMES BOND
2  GEORGE BUSH
3  BILL CLINTON
4 etc.....

...up to 100 rows.

How would I update the ROWID to ROWID+15?

I guess I need to do it in reverse order, starting with ROWID 100=>115, then ROWID 99=>114, as I get a duplicate key error if I just do a regular:

update `MYTABLE` set `ROWID`=`ROWID`+15

What little bit of MySQL am I missing?

Thanks,

Paul

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros