【发布时间】:2018-12-25 21:44:57
【问题描述】:
所以我的数据库中有两个表,Table_1 和 Table2。
Table_1 包含三列:名字、姓氏和年龄。
Table_2 也有三列:名字、姓氏和年龄。
表之间的唯一区别是 Table_2 中的 Age 列不包含任何数据。我要做的是在 Table_2 的 Age 列中进行搜索/查询,它将在 Table_1 中搜索 First Name 值,如果在 Table_1 中找到该名称,则在表 2 的 Age 列中显示该值。
Table_1
First Name Last Name Age
John Smith 30
David Smith 30
James Smith 40
Table_2
First Name Last Name Age
John Smith (Will return 30)
David Smith (Will return 30)
James Smith (Will return 40)
这是通过计算列以某种方式完成的吗?
【问题讨论】:
-
你使用哪个 dbms
标签: sql