小编Kee*_*thi的帖子

如何从mysql表中检索重复记录的最新数据

我正在尝试从 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
Run Code Online (Sandbox Code Playgroud)

我的 O/P 应该包含每种技术的最新数据

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
Run Code Online (Sandbox Code Playgroud)

mysql query-optimization database-performance groupwise-maximum

1
推荐指数
1
解决办法
55
查看次数