[英]Is there a way to give ID to other tables based on an ID with one table?
I have two tables as following:我有两个表如下:
ID ![]() |
Name![]() |
Age![]() |
---|---|---|
1 ![]() |
aaa![]() |
23 ![]() |
2 ![]() |
bbb ![]() |
21 ![]() |
3 ![]() |
ccc![]() |
25 ![]() |
4 ![]() |
ddd ![]() |
20 ![]() |
ID ![]() |
Name![]() |
Age![]() |
Phone![]() |
---|---|---|---|
aaa![]() |
23 ![]() |
0000 ![]() |
|
bbb ![]() |
21 ![]() |
1111 ![]() |
|
ccc![]() |
28 ![]() |
2222 ![]() |
|
ddd ![]() |
29 ![]() |
3333 ![]() |
The first table name as T1 include ID that I gave them unique ID, however from the second table T2 the ID column is empty.作为 T1 的第一个表名包括我给它们唯一 ID 的 ID,但是在第二个表 T2 中,ID 列是空的。 How can I add the same ID to the second table T2?
如何将相同的 ID 添加到第二个表 T2? Note: The order of the names is different, and I have about 3000 records.
注意:名字顺序不一样,我大概有3000条记录。 Can anyone help me how to do that by Microsoft Excel or Access or by programming language python?
任何人都可以通过 Microsoft Excel 或 Access 或编程语言 python 帮助我如何做到这一点?
Regards,问候,
Try with an update query having a subquery:尝试使用具有子查询的更新查询:
Update T2
Set T2.ID =
(Select Top 1 T1.Id
From T1
Where T1.Name = T2.Name)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.