SQL查询 - 按加密时间最长的文件列表

时间:2013-11-04 10:00:33

标签: mysql sql

我需要按文件加载时间过滤db表。

这就是我现在所拥有的:

SELECT url, timings_wait, SUM( timings_wait ) 
FROM request_detail
GROUP BY url
ORDER BY SUM( timings_wait ) DESC 
LIMIT 0 , 30

查询选择所有文件,为每个文件加载加载时间,并按列表的总加载时间对列表进行排序;

请帮助按照每个文件最长的时间排序列表,而不是总加载时间

2 个答案:

答案 0 :(得分:0)

SELECT url, timings_wait, SUM( timings_wait ) AS s, MAX( timings_wait ) AS m
FROM request_detail
GROUP BY url
ORDER BY MAX( timings_wait ) DESC 
LIMIT 0 , 30

答案 1 :(得分:0)

SELECT url, timings_wait, SUM( timings_wait ) 
FROM request_detail
GROUP BY url
ORDER BY timings_wait DESC 
LIMIT 0 , 30