MySQL Forums
Forum List  »  Newbie

ERROR 1064 (42000) - any help appreciated!
Posted by: evan carr
Date: October 27, 2007 01:03AM

Hi, im having a problem running a query using the following table:

mysql> desc news;
+-------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------------+------+-----+---------+----------------+
| n_id | int(1) | NO | PRI | NULL | auto_increment |
| main | varchar(1000) | YES | | NULL | |
| |
+-------+---------------+------+-----+---------+----------------+



the query is:


mysql> update news
-> set main = (select main
-> from news
-> where n_id = 1)
-> where n_id = 2;




and here is the error message:

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 'main = (select main
from news
where n_id = 1)
where n_id = 2' at line 2


the query is intended to set the "main" field where n_id =2 to the same value as "main" where n_id=1.

Any help would be appreciated!



Edited 1 time(s). Last edit at 10/27/2007 01:03AM by evan carr.

Options: ReplyQuote


Subject
Written By
Posted
ERROR 1064 (42000) - any help appreciated!
October 27, 2007 01:03AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.