MySQL Forums
Forum List  »  Newbie

Re: Insert data from CONCAT data from one table using select statement into new table
Posted by: Tim Burke
Date: May 27, 2019 08:36AM

I figured it out... This is exactly what I wanted to do.


CREATE TABLE username (
usernameID INT AUTO_INCREMENT PRIMARY KEY,
IDNumber INT NOT NULL,
username CHAR(6),
FOREIGN KEY (IDNumber) REFERENCES person(IDNumber));

insert into username (IDNumber, username) select IDNumber, (concat(substring(FirstName,1,1),substring(LastName,1,1),substring(IDNumber,1,4))) username from person;

Options: ReplyQuote


Subject
Written By
Posted
Re: Insert data from CONCAT data from one table using select statement into new table
May 27, 2019 08:36AM


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.