Databases :: MySql :: UPDATE what am I missing? |
|||
| By: Squibi |
Date: 12/09/2004 00:00:00 |
Points: 25 | Status: Answered Quality : Excellent |
|
This SQL will not work under MySQL, but does work under Office DB2 and Oracle. UPDATE tableA, tableB SET tableA.usergroupid=8 WHERE tableB.userid= tableA.userid AND tableB.country= 'United Kingdom' AND tableA.usergroupid='5' What am I missing? |
|||
| By: VGR | Date: 12/09/2004 08:26:00 | Type : Comment |
|
| nothing (except the closing semicolon). This should work. | |||
| By: Squibi | Date: 12/09/2004 09:55:00 | Type : Comment |
|
| nope doesn't work (even with the closing semicolon) |
|||
| By: VGR | Date: 13/09/2004 05:23:00 | Type : Comment |
|
| first it's rather surprising to see this cohabitate : tableA.usergroupid='5' set tableA.usergroupid=8 integer and varchar... |
|||
| By: VGR | Date: 13/09/2004 05:27:00 | Type : Answer |
|
| now, for the cause of the error (BTW, you didn't say WHICH ERROR YOU GOT :/ ) 6.4.5 UPDATE Syntax UPDATE [LOW_PRIORITY] [IGNORE] tbl_name SET col_name1=expr1 [, col_name2=expr2 ...] [WHERE where_definition] [ORDER BY ...] [LIMIT rows] or UPDATE [LOW_PRIORITY] [IGNORE] tbl_name [, tbl_name ...] SET col_name1=expr1 [, col_name2=expr2 ...] [WHERE where_definition] UPDATE updates columns in existing table rows As you can read here, you need MySql 4.0.4 to perform the query you try to use : Starting with MySQL Version 4.0.4, you can also perform UPDATE operations that cover multiple tables: UPDATE items,month SET items.price=month.price WHERE items.id=month.id; Note: you can not use ORDER BY or LIMIT with multi-table UPDATE. For subqueries in MySql you should look at <A HREF="http://www.mysql.com/doc/en/Nutshell_4.1_features.html">http://www.mysql.com/doc/en/Nutshell_4.1_features.html</A> |
|||
|
Do register to be able to answer |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








