Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

SQL query to get same day chek in time on different columns.

$
0
0

Hello! I'm having a little trouble getting around to get a report from a sql table where i have all the employees check in and check out times. 

The data looks like this:

Text
ID	CHECKTIME
33	2016-04-01 08:59:08
33	2016-04-01 13:00:22
33	2016-04-01 13:53:52
33	2016-04-01 19:00:51
34	2016-04-04 09:00:00
34	2016-04-04 17:00:00

And what I'm trying to achieve is to get the data like this

Text
ID	DAY		CHECK1		CHECK2		CHECK3		CHECK4
33	2016-04-01	08:59:08	13:00:22	13:53:52	19:00:51
34	2016-04-01	09:00:00	17:00:00

I can't get around how to aggregate the data. I can get Max and Min of every day but i miss the middle.

Thank you very much


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>