question

priyamca3 avatar image
priyamca3 asked

how to calcalate idle time

my requirement maxim idle time calculale my table structure(table one table name(tb_BusDetails) my field busid, IMEI,VehicleRegisterNo second table Busid, LogDateTime already i calating datetimeday d:H:r:s select a.LogDateTime , CAST(DATEDIFF(DAY ,a.LogDateTime, GETDATE()) % 24/7 AS NVARCHAR(50)) + ':' + CAST(DATEDIFF(HOUR ,a.LogDateTime, GETDATE()) % 24 AS NVARCHAR(50)) + ':' + CAST(DATEDIFF(MINUTE, a.LogDateTime, GETDATE()) % 60 AS NVARCHAR(50)) + ':'+ CAST(DATEDIFF(SECOND ,a.LogDateTime, GETDATE())%60 AS NVARCHAR(50)) as Duration from tb_VTSData as a inner join tb_BusDetails as b on a.BusID=1 plz any one help urgent
sql-server-2008
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

priyamca3 avatar image priyamca3 commented ·
plz urgent
0 Likes 0 ·

1 Answer

·
priyamca3 avatar image
priyamca3 answered
how i calcalte maxim bus id `and my table structure(table one table name(tb_BusDetails) my field busid, IMEI,VehicleRegisterNo second table Busid, LogDateTime select a.LogDateTime , CAST(DATEDIFF(DAY ,a.LogDateTime, GETDATE()) % 24/7 AS NVARCHAR(50)) + ':' + CAST(DATEDIFF(HOUR ,a.LogDateTime, GETDATE()) % 24 AS NVARCHAR(50)) + ':' + CAST(DATEDIFF(MINUTE, a.LogDateTime, GETDATE()) % 60 AS NVARCHAR(50)) + ':'+ CAST(DATEDIFF(SECOND ,a.LogDateTime, GETDATE())%60 AS NVARCHAR(50)) as Duration from tb_VTSData as a inner join tb_BusDetails as b on a.BusID=1
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.