안녕하세요
다들 추석을 잘 보내셨나요.
좋은 추석 보내셨기를 바라며, 궁금한 부분이 문의 드립니다.
id , time
1 2016/09/18 01:11:23:12 AM
2 2016/09/18 01:12:23:12 AM
3 2016/09/18 01:13:23:12 AM
4 2016/09/18 01:14:23:12 AM
5 2016/09/18 01:16:23:12 AM
6 2016/09/18 01:30:23:12 AM
7 2016/09/18 01:41:23:12 AM
8 2016/09/18 03:05:23:12 AM
9 2016/09/18 05:07:23:12 AM
10 2016/09/18 07:11:23:12 AM
11 2016/09/18 08:11:23:12 AM
12 2016/09/18 11:11:23:12 AM
13 2016/09/18 05:11:23:12 PM
1 2016/09/18 01:11:23:12 AM
5 2016/09/18 01:16:23:12 AM
6 2016/09/18 01:30:23:12 AM
7 2016/09/18 01:41:23:12 AM
8 2016/09/18 03:05:23:12 AM
9 2016/09/18 05:07:23:12 AM
10 2016/09/18 07:11:23:12 AM
11 2016/09/18 08:11:23:12 AM
12 2016/09/18 11:11:23:12 AM
13 2016/09/18 05:11:23:12 PM
SELECT a.*
FROM 테이블 as a,
(
select MIN(id) as id
from 테이블
group by LEFT(CONVERT(NVARCHAR(20), time, 121), 16), DATEPART(MINUTE, time) / 5
) as b
where a.id =b.id
ORDER BY a.id