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

  • Home
  • SEARCH
  • 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 8032049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:16:38+00:00 2026-06-05T01:16:38+00:00

so suppose there’s a table: id column1 column2 1 333 4444 Where id is

  • 0

so suppose there’s a table:

id column1 column2

 1   333     4444

Where id is a primary key

And then I do

REPLACE INTO table (id, column2) VALUES (1, 55)

This will cause column1 to become null…is there a way to specify the query such that it will leave whatever existing value of column1 is when REPLACE matches an existing entry?

  • 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-05T01:16:40+00:00Added an answer on June 5, 2026 at 1:16 am

    Use INSERT ... ON DUPLICATE KEY UPDATE:

    INSERT INTO table (id, column2) VALUES (1, 55)
    ON DUPLICATE KEY UPDATE column2 = VALUES(column2)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose there was a SQL table like this: Label Name | Last name |
Suppose there are 3 keywords, I don't want to do this kind of replace
Suppose there is a table like this: f1 f2 ---------- 1 3 4 8
Suppose there are ~10,000's of keys, where each key corresponds to a stream of
Suppose there is a table A which has a column AccessRights which is multivalued(
Suppose there is a System A which gives some output. This output is used
Suppose there is a MSSQL table, UserPost , that represents something user has posted,
suppose there is a script doing something like this: # module writer.py import sys
suppose there 5 column in my table info(id,loginid,pagename,pagecount,detail). I am executing the query like,
Suppose there is table (Tbl_Test) with 7 columns A,B,C,D,E,F,G and similarly there is an

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.