[thelist] [mysql] multiple update query

Joshua Olson joshua at waetech.com
Wed Mar 10 08:43:37 CST 2004


> -----Original Message-----
> From: kris burford
> Sent: Wednesday, March 10, 2004 9:33 AM
>
> okay. not sure i 100% understand what you're suggesting, but i *think*
> you're saying to do it by pulling the entire contents out of the original
> table (a), creating a new table (b), pushing all the old rows with the
> updated content into b, then deleting (or better yet, renaming) a
> and then renaming b to a's original name.

Kris,

Not exactly...  Only the new data gets inserted into the temp table...
something like this:

CREATE TABLE #temp (fields)

INSERT INTO #temp (fields) VALUES (values), (values), etc

UPDATE thetable
SET thefield = #temp.newvalue
FROM thetable
INNER JOIN #temp
ON #temp.pk = thetable.pk

DROP TABLE #temp

What I'm not sure about is MySQL's support for this syntax.

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com/service_areas/
706.210.0168




More information about the thelist mailing list