Get the time difference between the first and last row

Viewed 4378

My table structure is like this

id date         Time                userid

17  2017-01-22  05:08:09.0000000    836232017
16  2017-01-22  05:08:05.0000000    836232017
11  2017-01-22  05:06:40.0000000    836232017
10  2017-01-22  05:06:38.0000000    836232017
7   2017-01-22  05:06:31.0000000    836232017

I need to get the time difference between the first and last value for the corresponding userid and date. Eg: the datediff for the userid 836232017 is between '05:08:09.0000000' and '05:06:31.0000000'. Please provide a solution for this.

2 Answers
Related