【发布时间】:2021-05-14 16:53:19
【问题描述】:
我在 Access 中有 2 个表:
表 1 有 id、first_name 和 last_name
表2有city、date_recorded和person_id
我正在尝试运行查询以显示最早日期的名字、姓氏和城市。
我可以通过以下查询来解决这个问题,但是当我尝试将城市添加到结果中时会显示所有记录。
如何将城市添加到结果中,但每人仍然只有 1 行?
SELECT table1.first_name, table1.last_name, Min(table2.date_recorded) AS First_Occurrence
FROM table1 INNER JOIN table2 ON table1.id = table2.person_id
GROUP BY table1.first_name, table1.last_name
ORDER BY Min(table2.date_recorded);
【问题讨论】: