MySQL Forums
Forum List  »  PHP

Re: Insert data from one table to another
Posted by: Barry Galbraith
Date: July 27, 2017 04:11PM

Without seeing the "SHOW CREATE TABLE" for the two tables I can only guess, so I'll guess that your username is a string and so needs to be quoted.

INSERT INTO table1 (index1) SELECT index2 FROM table2 WHERE username = 'admin';

To prove it, try the select statement on its own and see what you get.

Good luck,

Options: ReplyQuote

Written By
Re: Insert data from one table to another
July 27, 2017 04:11PM

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.