Hi Jason,

If I understand correctly you need the SELECT statement first to detemine 
which records to update. However perhaps on the SELECT statement you could 
speed up things by showing only the required columns and not all. While this 
doesnt make a big difference for small tables, it can make one on big tables 
;-).

I know it is not what you were originally asking for, but in this way you 
could increase the availability of the server.


Best regards

Nils Valentin
Tokyo/Japan


2003年 6月 24日 火曜日 16:02、Jason さんは書きました:
> 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.

-- 
---
Valentin Nils
Internet Technology

 E-Mail: [EMAIL PROTECTED]
 URL: http://www.knowd.co.jp
 Personal URL: http://www.knowd.co.jp/staff/nils


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

Reply via email to