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 8023523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:35:12+00:00 2026-06-04T22:35:12+00:00

I have some networked equipment that’s attached to multiple networks/VLans (A, B & C),

  • 0

I have some networked equipment that’s attached to multiple networks/VLans (A, B & C), and other equipment that’s just connected to one of the networks. When I remove or replace a network, I need to update my database to reflect what the equipment is attached to so I’m trying to write a mysql statement to do that, but I’m running into various road blocks.

My table only has two fields and there cannot be duplicate records. My data example is

deviceID network
1        A
1        B
1        C
2        B
2        C
3        A
4        A
5        B

How can I merge network A into network B so the above table would look like…

deviceID network
1        B
1        C
2        B
2        C
3        B
4        B
5        B

My initial attempt was to just set network = 'B' where network = 'A', followed by a DELETE network 'A' statement but that would create duplicates, which isn’t allowed for that table – even though the duplicates would be brief. Using alternate methods, I just keep running into failed mysql statements by using WHERE EXISTS and various FROM (SELECT) statements. Is it possible to do in a single mysql statement? Do I need two?

Any help is appreciated.

  • 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-06-04T22:35:13+00:00Added an answer on June 4, 2026 at 10:35 pm

    You could use UPDATE IGNORE with your update statement – this would skip any updates that caused duplicates. You would then follow this with a DELETE to clear the rows that had been skipped. For example:

    UPDATE IGNORE mytable SET network = 'B' WHERE network = 'A';
    DELETE FROM mytable WHERE network = 'A';
    

    From the documentation:

    With the IGNORE keyword, the update statement does not abort even if
    errors occur during the update. Rows for which duplicate-key conflicts
    occur are not updated. Rows for which columns are updated to values
    that would cause data conversion errors are updated to the closest
    valid values instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have lots(+2000) of GUIDs(in some network class) and my program must find one
I have a program that performs some network IO that compiles a 32 bit
Due to network or some other reasons, some sites do not have their css
I have an activity that runs some ASCII control over a network port to
I have a function that returns json (networks_function.php builds up some arrays and encodes
I have a class which works with social networks related stuff. At some point
I have some values that are stored with core data, and I have opened
I'm developing some code that is simulating network equipment. I need to run several
I have some methods in my app that make http requests. Is there a
I have some python code that was written by a developer before me. It

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.