Zeno wrote:

Thanks, Brent. I did read about the REPLACE command, but I only want
to change one field (a simple flag) in the main_table. With REPLACE,
I cannot even copy the rest of the fields into the new record because
it does not offer any access to the existing fields.

It may seem strange, but 'yes you can'.

Say you have table1 with columns 'a', 'b' and 'c' and you add column 'd' which you want to update from a value in 'a' (example query):

BEGIN;
CREATE TEMPORARY TABLE replace_table1 SELECT a, b, c, {calculation} as d FROM table1;
REPLACE INTO table1 (a, b, c, d) SELECT a, b, c ,d FROM replace_table1;
COMMIT;

--
Michael T. Babcock
C.T.O., FibreSpeed Ltd.
http://www.fibrespeed.net/~mbabcock



---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



Reply via email to