简体   繁体   English

将记录从一个表复制到另一个表+添加自己的记录

[英]Copy record from a table to another table + add own record

I have a table name Users and a table name Application. 我有一个表名Users和一个表名Application。

I want to insert 3 data into 3 columns (id,password,privilege) at Users table. 我想在Users表的3列(id,password,privilege)中插入3个数据。

How do i extract 2 data from Application table (email_address,password) then i add own data in privilege column at Users table. 我如何从应用程序表(电子邮件地址,密码)中提取2个数据,然后在用户表的特权列中添加自己的数据。

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 privileges代表用户特权

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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