排序依据和分组依据
是否有一种有效的方法来执行排序依据和分组依据,以便您从每个组(从排序依据)中获取特定的项目。
//This is the best way i have come up with.
SELECT D.*
FROM (
SELECT *
FROM devices
ORDER BY time
) AS D
GROUP BY D.location
Is there an efficient way to do an order by and group by so that you get a specific item from each group (from the order by).
//This is the best way i have come up with.
SELECT D.*
FROM (
SELECT *
FROM devices
ORDER BY time
) AS D
GROUP BY D.location
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这对我有用
This worked for me
不需要子查询
No need for sub-queries