Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
select convert(datetime,convert(varchar(8),[TimeTag],112)) as Date, Name, Street, convert(varchar,datediff(hh,0,(dateadd(ss,sum(ts_seconds) ,0))))+ substring((convert(varchar(8),(dateadd(ss,sum(ts_seconds) ,0)),114)),3,3) as HrsMin from ( SELECT u.Name, Street, datediff(ss,t1.Timein,t2.Timeout) as ts_seconds FROM ( Select UserID, Street,Timetag, ((Select Top(1) Timetag as Timein from dbo.GPSData t2 where t2.UserID = t1.UserID and convert(varchar(8),t2.Timetag) = convert(varchar(8),t1.Timetag) -- must be same day and MAX (Timetag) order by t2.Timetag asc, RecID asc),0) as Timeout --get error here from dbo.GPSData t1 ) times INNER JOIN dbo.Users U ON (times.UserID = U.UserID) GROUP BY u.Name, times.Street,ts_Day, TS_Day2 ) daily GROUP BY name, street, ts_Day,TS_Day2, ts_seconds ORDER BY name, street, ts_Day, TS_Day2, ts_seconds
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.