Theoretically, you should be able to do a multi-table update since MYSQL
3.23, like this:

UPDATE tablename, tablename2 SET  tablename.field1  =  'yes' WHERE
tablename.userid = tablename2.userid;

I haven't tested it, though.


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]

Sent: 1. júlí 2003 02:33
To: [EMAIL PROTECTED]
Subject: [PHP] need help w/ sql query - update and select at once

hi i'm trying to get this sql query to work, i'm trying to update and
select at the same time, i'm not even sure if this  is even possible

update db.tablename set field1='yes' where (select * from
db.tablename,db.tablename2 where
db.tablename.userid=db.tablename2.userid);

basically i have a column called 'userid'.  this column exists in both
tablename, and tablename2.  where the value of userid in tablename is
equal to the value of userid in tablename2, i'd like to set the value of
field1 to 'yes'.

can this be done from the command line?  or am i better off writing
another php page to accomplish this?

thanks again
redmond



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to