简体   繁体   English

MySQL如何根据用户ID值将数据从一个表复制到另一表

[英]MySQL how to copy data from one table to another table based on User ID value

I'm not good at coding at all so I need some help in figuring this out. 我根本不擅长编码,因此我需要一些帮助来解决这个问题。

I have two tables one named 'registration' and one named 'users'. 我有两个表,一个名为“ registration”,另一个名为“ users”。

In the 'registration' table i have a field called "officers name" which is filled with integers ranging from 1 to 40. These values correspond to "User ID" (primary key) value in the 'users' table, which corresponds to a persons name in the "full name" field. 在“注册”表中,我有一个名为“军官姓名”的字段,该字段填充了1到40之间的整数。这些值对应于“用户”表中的“用户ID”(主键)值,它对应于人员姓名在“全名”字段中。

What I need to be able to do is have whatever the value is in the "officers name" field, replace it with whatever value is in the "Full name" field with the corresponding integer value. 我需要做的就是在“军官姓名”字段中使用任意值,然后用“整数”字段中的相应值替换为相应的整数值。

my issue is that there are 1400 entries, and these values repeat multiple times, so I'm not even sure how I would go about doing that. 我的问题是有1400个条目,并且这些值重复多次,所以我什至不知道该怎么做。

Anyone have any ideas? 有人有想法么?

Something like this to get you started: 这样的东西可以帮助您入门:

SELECT     u.fullName
FROM       users u
INNER JOIN registration r ON (u.userID = r.userID)

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

相关问题 如何根据 MySQL 中第三个表中存在的 ID 将数据从一个表复制到另一个表? - How to copy data from one table to another based on ids present in third table in MySQL? 如何将数据从一个表复制到 MySQL 中的另一个新表? - How to copy data from one table to another new table in MySQL? MySql中如何将列数据从一张表复制到另一张表? - How to Copy Column data from one table to another table in MySql? 如何在MySQL中将数据从一个表复制到另一个表? - How to copy data from one table to another in MySQL? 如何在MySQL中将数据从一个表复制粘贴到另一个表? - How to copy-paste data from one table to another in MySQL? MYSQL,将数据从一个表复制到另一个表,以varchar为增量 - MYSQL, copy data from one table to another table with increment in varchar MySQL:如何将没有ID的一个表中的列复制到另一个表中? - MySQL: How to copy column from one table without id into another table? 如何将一个表数据复制到另一个表,其中包含 2 个 wherecondtion 和一个 if 条件 MYSQL - How to Copy one table data to another table with 2 wherecondtion and an if condtion MYSQL MySQL:从另一个表中更新一个表中的id值 - MySQL: Updating id value in one table from another table 通过与条件匹配的id根据另一个更新MySQL表值 - update one MySQL table value based on another by id match with conditions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM