On 14.02.2012 10:20, Alex Schaft wrote:

Hi,

I need to update a table along the lines of the following

update table set LastUpdate=now(), UpdateSource='Abc' Where Key1 = 'Def'
and Key2 = 'ghi'

I need to possible do anywhere from 2 to 20 of these. Would it be better
to call an update statement for each of these,

What exactly are "these"? Is 'Abc' constant for all rows, or does it change for each Key1&Key2 value?

If so, then simply
WHERE (Key1=... AND Key2=...) OR (Key1=... AND Key2=...) OR... should suffice
or even:
WHERE (Key1, Key2) IN (val1, val2),(val3,val4), ...

If 'Abc' changes per Key1&Key2 values, explore the CASE statement.

Best,

/ Carsten

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

Reply via email to