【发布时间】:2021-10-22 14:17:56
【问题描述】:
我正在尝试从我的 sql 表中检索每条记录的最新数据。每条记录都会有重复的数据,并有一些数据更改。我需要检索最新的时间戳数据。有人可以建议在性能方面哪个是最佳解决方案。已经看到了一些内部连接和子查询的解决方案。
下面给出的示例数据
Technology Students Amount Area Date
python 500 1000 Bangalore 2021-08-06 12:03:26
Ruby 100 1000 Bangalore 2021-08-06 05:18:50
Java 300 1000 Bangalore 2021-08-06 18:23:40
python 900 1000 Bangalore 2021-08-06 16:23:30
Java 100 1000 Bangalore 2021-08-06 12:23:50
Ruby 500 1000 Bangalore 2021-08-06 15:13:40
my o/p should contain latest data for each tech
Technology Students Amount Area Date
Java 300 1000 Bangalore 2021-08-06 18:23:40
python 900 1000 Bangalore 2021-08-06 16:23:30
Ruby 500 1000 Bangalore 2021-08-06 15:13:40
【问题讨论】:
-
请分享您使用的mysql版本。
-
5.6为版本
-
这是一个关于如何获得所需结果的问题,还是关于您尚未分享的解决方案的性能问题?
-
我实际上是在寻找以性能为导向的解决方案
标签: mysql query-optimization database-performance groupwise-maximum