Message: 2 Date: Wed, 16 Jul 2008 09:36:24 -0400 From: Daniel Barrett danb@VistaPrint.com Subject: [Mediawiki-l] 2-table update using Database.php? To: MediaWiki announcements and site admin list mediawiki-l@lists.wikimedia.org Message-ID: 9445EBEE35E2D148921D2550399D1D3715CB321E@vpmail102.vistaprint.net Content-Type: text/plain; charset="us-ascii"
Is there a way to perform a two-table SQL Update statement using functions in Database.php?
update table1, table2 set table1.x = table2.y where table1.foo = table2.bar
Function Database.php::update() appears to accept only a single table name. (This is in MW 1.12.)
Thanks. DanB
mmm... this seems a SQL issue :-)
well, you can update joined table, but you must select the PK.
as example:
update ( select table1.id, table1.x as x, table2.id, table2.y as y where table1.foo = table2.bar ) set x=y
G.
--
Giuseppe Briotti g.briotti@mclink.it
"Alme Sol, curru nitido diem qui promis et celas aliusque et idem nasceris, possis nihil urbe Roma visere maius." (Orazio)
mediawiki-l@lists.wikimedia.org