如何从这组给定的值中选择第一次

时间:2014-08-08 09:58:05

标签: mysql

大家好我有这个时间专栏这样的数据

time    |
------- |
9:17:19 |
9:17:23 |
9:17:28 |
9:17:33 |
9:17:38 |
9:18:03 |
9:18:08 |
9:18:13 |
9:18:18 |
9:19:03 | 
9:19:13 |
9:19:59 |
9:20:04 |
9:20:59 |
9:21:04 |
9:21:09 |
9:21:54 |
9:21:59 |
9:22:04 |
9:22:09 | 

从这一栏开始,我的结果应该是我想要的每一分钟

9:17:19 |
9:18:03 |
9:19:03 |
9:20:04 |
9:21:04 |
9:22:04 |

如果有任何错误,请原谅我。

3 个答案:

答案 0 :(得分:2)

假设time具有TIME数据类型:

  SELECT MIN(time)
    FROM table
GROUP BY LEFT(time,5)
ORDER BY time;

或者更少污秽:

  SELECT MIN(time)
    FROM table
GROUP BY HOUR(time), MINUTE(time)
ORDER BY time;    

答案 1 :(得分:1)

可能是这样的

SELECT MIN(Time) 
FROM Table1
GROUP BY HOUR(time),MINUTE(Time)

<强> FIDDLE DEMO

答案 2 :(得分:0)

简单,它是:

 select * from table_name group by concat(hour(`time`), minute(`time`));