List:General Discussion« Previous MessageNext Message »
From:Hal Date:November 24 2011 1:12pm
Subject:"UPDATE" with variable
View as plain text  
It seems to me that UPDATE is well designed for constants, and functions that do not
depend on the database, but when I want to UPDATE based on a table, I run into trouble.
See, this is not allowed:

mysql> update address set membersince = (select membersince from address where memberid
> = 1258) where memberid = 1724;

An intermediat variable is the only way, right? And sometimes I want to change many of a
field from another table: I read that subqueries are to be avoided, but in this case I
cannot find any means other than correlated subquery to do that. Eh?

"UPDATE" with variablehsv24 Nov
  • Re: "UPDATE" with variableJohan De Meersman28 Nov