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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:30:59+00:00 2026-06-13T01:30:59+00:00

I have an INSERT INTO … ON DUPLICATE KEY UPDATE query that for some

  • 0

I have an INSERT INTO … ON DUPLICATE KEY UPDATE query that for some reason is being ignored by the mysql server, at least as far as I can tell.

It’s catching on an update of an existing row.

I have a primary key of “id” and part_no is listed as Unique.

Here is the query:

INSERT INTO parts_prices (cost, 
chatsworth, 
atlanta,
north_carolina,
new_jersey,
arizona, 
colorado,
miami,
indianapolis, 
ohio, 
oregon,
dallas,
san_antonio,
washington,
memphis,
alt_sup,
part_no)
VALUES (0.00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 'HS3163')
ON DUPLICATE KEY UPDATE 
cost=VALUES(cost), chatsworth=VALUES(chatsworth), atlanta=VALUES(atlanta), north_carolina=VALUES(north_carolina), new_jersey=VALUES(new_jersey), arizona=VALUES(arizona), colorado=VALUES(colorado), miami=VALUES(miami),
indianapolis=VALUES(indianapolis), ohio=VALUES(ohio), oregon=VALUES(oregon), dallas=VALUES(dallas), san_antonio=VALUES(san_antonio), washington=VALUES(washington), memphis=VALUES(memphis), alt_sup=VALUES(alt_sup)

The first column is a decimal, then a bunch of ints, and the last two are varchars. This is an entry in a parts list database (we happen to list the part number, but don’t actually have it yet). I’m iterating through a list of all of the part numbers (by using a last_modified column) and this particular query doesn’t update the timestamp.

Could this be because the information in the row isn’t actually changing (all specified values are identical to the initial values)?

The query worked for (quite a few) previous entries in the database.

[edit] I’ve checked for response errors in the query from the PHP script and directly (using phpmyadmin), they do not return any error string. [/edit]

  • 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-13T01:31:00+00:00Added an answer on June 13, 2026 at 1:31 am

    on update current_timestamp only takes effect if at least one of the columns is actually updated. If you try to update a row with the values it already has, it doesn’t count as an update (the affected rows count is unchanged) and the on update doesn’t take effect.

    It would be more reliable to manually add last_modified=now() to your update.

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

Sidebar

Related Questions

I have an INSERT INTO ... ON DUPLICATE KEY UPDATE ... statement that executes
Right now I have: INSERT INTO mytable (a,b,c,d) VALUES(1,2,3,4) ON DUPLICATE KEY UPDATE c=VALUES(c),d=VALUES(d)
I have an insert query that gets generated like this INSERT INTO InvoiceDetail (LegacyId,InvoiceId,DetailTypeId,Fee,FeeTax,Investigatorid,SalespersonId,CreateDate,CreatedById,IsChargeBack,Expense,RepoAgentId,PayeeName,ExpensePaymentId,AdjustDetailId)
I have an insert statement that pulls some data into a few table variables
First time I am trying duplicate key to have insert and update in one
Hey guys quick question, I currently have an insert statement $query= INSERT into new_mail
I have a query insert into carsdescription (description,idCar) value (@description,@idCar) where idCar=@idCar; select nameOfCar
I have a query: insert into #tmpRcIzm select distinct v.id_art, 'Y' from openxml(@hDoc, '/art_komp/nol')
I have the following query: INSERT INTO table (a, b, c) VALUES (NOW(), NOW()
I have some problem whith such mysql_query INSERT INTO table VALUES ('', CURDATE()-1) why

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.