[英]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.