RE: [PHP] need help w/ sql query - update and select at once

From: Date: Tue, 01 Jul 2003 21:08:29 +0000
Subject: RE: [PHP] need help w/ sql query - update and select at once
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-153613@lists.php.net to get a copy of this message
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: r-militante@northwestern.edu [mailto:r-militante@northwestern.edu] Sent: 1. júlí 2003 02:33 To: php-general@lists.php.net 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

« previous php.general (#153613) next »