No results when I execute a simple update query

I don’t get any errors, just zero rows affected. Yes, I double checked that the topicID in this case is really 1130.

Any thoughts?

update topics set brandNeutral = ‘No’, product = ‘Yes’ where topicID = 1130;

brandNeutral ready ‘No’, product ready ‘Yes’. “Affected rows” means “rows that was changed”.

Maybe?

https://dev.mysql.com/doc/refman/8.0/en/update.html

If you set a column to the value it currently has, MySQL notices this and does not update it.

UPDATE returns the number of rows that were actually changed.

The row starts with brandNeutral being Yes, and product being No. So this simple update should have altered these two columns, but did not.

Any other ideas on what this is happening?

  1. Is topicID integer?

  2. Are this fields part of unique index?

Yes, the data type for topicID is INT.

The only unique index for this table is on the topic column, not the topicID, brandNeutral or product columns.

here’s what i would do

  1. dump the table (this produces CREATE TABLE and INSERT INTO statements)
  2. edit the SQL to create a different table
  3. delete most rows to be inserted, but leave a representative sample
  4. load the different table with the sample data
  5. test your query again on this table

betcha it works

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.