Hi. You have analyzied the situation correctly. AFAIK, there is no way to do this with one query until sub-selects are going to be supported, and you have to use one of the work-arounds you described.
Bye, Benjamin. On Sun, Apr 28, 2002 at 10:13:49AM -0700, [EMAIL PROTECTED] wrote: > I'm wondering if there's a way to use the results of a SELECT in an UPDATE > operation, the way that it's possible to do so with INSERT and REPLACE. > This seems like it should be possible, but as far as I can tell, it's not. > > This comes up for me repeatedly, but the problem at hand is identifying the > parent message for a table containing discussion meta-data. I can query to > find the earliest occurrence of each subject, but the only way I seem to be > able to update the records with this data in a "parent message" field is to > retrieve them programmatically and do updates. Anything that I can do > within MySQL is much, much faster, so I'm trying to avoid that. > > I could create a temporary table with all of the columns, including the > updated one, then do a replace back into the original one, but that seems to > be a lot of overhead for what should be an update, rather than a replace. > > Any suggestions? > > Nick -- [EMAIL PROTECTED] --------------------------------------------------------------------- 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