I just ran the following sql (on mysql 4.1.20):
update tbl set col1=col2, col2=col1
To my surprise, mysql updates col1 via col1=col2 before reading it for
use in col2=col1, so I end up with the same value in both columns,
which, of course, was not my intention. Thinking about it, this behavior
in mysql makes perfect sense, so thats not the issue.
I could of course add a temporary col3 to use as a kind of buffer field,
and do
<alter table to add col3>
update tbl set col3=col1, col1=col2, col2=col3, col3=''
<alter table to remove col3>
That seems like a waste to me tho. There must be a smarter way.
So my question is:
Does anyone know of a way to force mysql to read all the values first
before actually doing the update? Or just has a smarter way of doing this?
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]