mysql> SELECT Ext, Pass, Name, Context FROM temp_Users WHERE temp_Users.Pass NOT IN (SELECT Pass FROM Users);
+------+-------+---------+------------+
| Ext | Pass | Name | Context |
+------+-------+---------+------------+
| 6003 | Hello | WebPone | DLPN_Admin |
+------+-------+---------+------------+
1 row in set (0.00 sec)
mysql> UPDATE Users
-> SET (Pass, Name, Context) = (SELECT Pass, Name, Context FROM temp_Users WHERE temp_Users.Pass NOT IN (SELECT Pass FROM Users))
-> WHERE Users.Ext = temp.Ext;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(Pass, Name, Context) = (SELECT Pass, Name, Context FROM temp_Users WHERE temp_' at line 2
I want to update my database from Select result and i am getting this error. Please tell me how i can resolve it ?
MySQL doesn’t support the
SET ( multiple_fields ) = ( subquery_that_returns_multiple_fields )syntax forUPDATEstatements. Instead, you have to use a “multiple-table” update (a join). See http://dev.mysql.com/doc/refman/5.6/en/update.html.Your query has some other problems as well, so I’m not clear on exactly what you want . . . but I think you want something like this: