简体   繁体   中英

Copy record from a table to another table + add own record

I have a table name Users and a table name Application.

I want to insert 3 data into 3 columns (id,password,privilege) at Users table.

How do i extract 2 data from Application table (email_address,password) then i add own data in privilege column at Users table.

Sorry if this is confusing.

You can use the following query:

INSERT INTO `Users` (id, password, privilege) 
SELECT email_address, password, 'privileges' FROM `Application`

Where privileges stands for the user privileges

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM