Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7692273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:48:58+00:00 2026-05-31T20:48:58+00:00

so I run UPDATE x SET y = y + 1; where y is

  • 0

so I run

UPDATE x
SET y = y + 1;

where y is a primary key for the table…but then suppose there are two entries in the table with y = 1,2,3…the query will complain about duplicate entry for key ‘PRIMARY’ since when it tries to update the one with y = 1 to y = 2, it’ll conflict with the other already existing entry with y = 2…is there a way to make mysql ignore this and just update everything anyway without manually removing the key….I know that I can just remove key temporarily and then execute this then re-add the key but I’m wondering if it’s possibly to do this without doing so…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:48:59+00:00Added an answer on May 31, 2026 at 8:48 pm

    You can try this

    UPDATE x SET y = y + 1 order by y DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When you run something similar to: UPDATE table SET datetime = NOW(); on a
I'm trying to run an update query that updates one table based on rows
When we run a update query we get prompt saying that 'these many records
When I try to run any update query in Access 2007, I get the
I am trying a simple UPDATE table SET column1 = 0 on a table
I have the following table of counters: CREATE TABLE cache ( key text PRIMARY
When I try to run update a credit card type by passing in the
Is it possible to run an UPDATE command on mysql 5.0 with a sub
Assuming that I cannot run something like this with Fabric: run(svn update --password 'password'
Good afternoon, I'm working on a project for my company to run an update

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.