how i can take the sum of times
-
Hi, I am using sql server 7.0 in that i am having a table of 3 feild i.e. empName, Logindate, HoursWorked select * from tablename Result: empName LoginDate HoursWorked ------- ------------ ------------ Amit 06/03/04 13:44:45 Amit 06/04/04 14:44:45 now i want the sum of the field "HoursWorked" Can any body help? Actually im taking 'LoginTime' and 'LogoutTime' Datatype 'DateTime' from "login" table and subtraction of this two field is strored in field 'TimeDiffrence' datatype varchar Query i m using is "convert(varchar(8),(logoutTime-loginTime),14)Timediffrence" now i want the sum of the field "Timediffrence"
-
Hi, I am using sql server 7.0 in that i am having a table of 3 feild i.e. empName, Logindate, HoursWorked select * from tablename Result: empName LoginDate HoursWorked ------- ------------ ------------ Amit 06/03/04 13:44:45 Amit 06/04/04 14:44:45 now i want the sum of the field "HoursWorked" Can any body help? Actually im taking 'LoginTime' and 'LogoutTime' Datatype 'DateTime' from "login" table and subtraction of this two field is strored in field 'TimeDiffrence' datatype varchar Query i m using is "convert(varchar(8),(logoutTime-loginTime),14)Timediffrence" now i want the sum of the field "Timediffrence"
-
try:
Select empName, Sum(Cast(HoursWorked as int))
From tablename
Group by empNameOr
Select empName, HoursWorked = Sum(DateDiff(ss, LoginTime, LogoutTime)) / 3600
From login
Group by empNameWout Louwers