如何找到最早的时间添加了一个外键
我的问题是我有一个外国钥匙列表和添加的日期,所以
+----------------+---------------+
| Foreign Key | Date |
+----------------+---------------+
| 4 | 2022-05-25 |
| 5 | 2022-05-30 |
| 4 | 2022-05-30 |
+----------------+---------------+
我需要的是只显示最早的日期,所以我不希望第二个“ 4”,因为它是在此之后创建的第一个。有什么方法可以显示每个密钥的最早日期?像这样:
+----------------+---------------+
| Foreign Key | Date |
+----------------+---------------+
| 4 | 2022-05-25 |
| 5 | 2022-05-30 |
+----------------+---------------+
My problem is that I have a list of foreign keys and the date that they were added, as so:
+----------------+---------------+
| Foreign Key | Date |
+----------------+---------------+
| 4 | 2022-05-25 |
| 5 | 2022-05-30 |
| 4 | 2022-05-30 |
+----------------+---------------+
What I require is that only the earliest date is displayed, so I do not want that second '4' as it was created after the first one. Is there a way that I can display just the earliest dates of each key? Like this:
+----------------+---------------+
| Foreign Key | Date |
+----------------+---------------+
| 4 | 2022-05-25 |
| 5 | 2022-05-30 |
+----------------+---------------+
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用
min()
功能Try using
MIN()
function