I've looked around and believe this to not be possible, but am checking just to be 
sure.

Basically I want to run the command

UPDATE MyTable SET SomeRecord = NewValue WHERE SomeRecord = OldValue

But, I need to know which rows were modified, not simply how many. So far this is the 
best that I have come up with

LOCK TABLES MyTable WRITE
SELECT * FROM MyTable WHERE SomeRecord = OldValue
UPDATE MyTable SET SomeRecord = NewValue WHERE SomeRecord = OldValue
UNLOCK TABLES

My question is.. isn't there a better way.  One that doesn't require 4 queries to do 
such a simple thing? Or one that can be safely
done in a multi user environment without locking the table?

The queries run very quickly, and I don't actually process the SELECT results until 
after the table is unlocked... but it's kinda
nagging at me that there must be a **better** solution than this.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to