SELECT and UPDATE in one query?

2002-02-20 Thread Felix Richter

Hi!

I need to SELECT some rows using a lengthy WHERE-clause and then to UPDATE these rows 
just to set a flag.  What is the best way to do this (performance-wise)? Being able to 
do that in one single query would be great because otherwise I had to use transactions 
to be sure to match _exactly_ the selected rows.

Felix

-
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




Re: SELECT and UPDATE in one query?

2002-02-20 Thread Fournier Jocelyn [Presence-PC]

Hi,

I think you can try to use REPLACE INTO table (a,b,c,d) SELECT e,f,g,h FROM
table2 WHERE field=what_you_want.

Best Regards,

Jocelyn Fournier
Presence-PC
- Original Message -
From: Felix Richter [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, February 20, 2002 3:01 PM
Subject: SELECT and UPDATE in one query?


Hi!

I need to SELECT some rows using a lengthy WHERE-clause and then to UPDATE
these rows just to set a flag.  What is the best way to do this
(performance-wise)? Being able to do that in one single query would be great
because otherwise I had to use transactions to be sure to match _exactly_
the selected rows.

Felix

-
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




-
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