MySQL Forums
Forum List  »  Newbie

Re: Help with syntax error 1064
Posted by: Barry Galbraith
Date: June 10, 2015 11:36PM

Lose the quotes around the table name and the column name.

If you MUST use reserved words as identifiers, then use back ticks (just left of the 1 key), not quotes.
INSERT INTO jobs.companyID
 SELECT * FROM companies.companyID
 WHERE jobs.company=companies.company;

or
INSERT INTO `jobs`.`companyID` SELECT * FROM `companies`.`companyID` WHERE `jobs`.`company`= `companies`.`company`;

but save yourself a LOT of typing (and errors) and don't use reserved words as identifiers.

BTW, your SELECT doesn't make sense.
You seem to be trying to insert into one column (companyID) multiple fieds SELECT * , and you need to SELECT ... FROM a_table_name, not a_table_name.column_name.

So, build the SELECT first, until it SELECTs the results you expect, then add the INSERT part.

Good luck,
Barry.

Options: ReplyQuote


Subject
Written By
Posted
June 10, 2015 10:05PM
Re: Help with syntax error 1064
June 10, 2015 11:36PM


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.