how to sum time in sql server 2008? -
How to sum the time column in SQL Server
I want good luck on Monday, Tuesday, Wednesday, On Thursday, Friday and Saturday and updated I Tot_hrs I have the update logic I am unable to sum from Monday to Saturday
Create table WEEKLY_ATTN ([SYSID] [int] identification (1, 1) Not empty, [EMPLOYEE_SYSID] [int] tap, [mon_de] [varchar] (10) tap, [tue_day] [varchar] (10) tap, [Wednesday] [varchar] (10) tap, [gurud day] [Varchar] (10) NULL, [Friday] [va Rchar] (10) NULL, [Saturday] [varchar] (10) NULL, [Tot_Hrs] [varchar] (20) NULL); INSERT WEEKLY_ATTN (employee_sysid, mon_day, tue_day, wed_day, thu_day, fri_day, sat_day) Price (41, '11: 01 ',' 11:57 ',' 11:02 ',' 10:19 ',' 09:26 ' ,Zero); Below is the query that I've used
select mon_day, tue_day, wed_day, thu_day, fri_Day, sat_day, cast (dateadd (s, isnull) Dated (S, 0, Mon_de), 0) + unknown (dated (0, Tue_day), 0) + isnull (dated (s, 0, wed_day), 0) + isnull (dated, 0, master-day), 0 ) + Isnull (dated (0, Friday, day), 0) + isnull (dated (s, 0, saturday, day), 0) as time (0) as weekly_tot from Tot_hrs where employee_sysid = 41; Mon_day Tue_day wed_day thu_day fri_Day sat_day tot_hrs ------------------------------------------- -------------- 11:01 11:57 11:02 10:19 9:26 ft 05:45:00 Although total hours 53 : 45 hours someone can correct me where this is wrong. Any help?
should be time varchar. Choose
, convert (varchar, DATEADD (ms, Tot_hrs * 1000, 0), 114) (select Mon_de, to_day, wide_day, thu_day, friday, saturday, unknown (cast (dated) (S, 0, Artist (Mon_de as time)) as float (0) cast (date, time as wed_day)), 0) + isnull (cast (dated (s, 0, cast (time) As Tue_day), 0) + isnull (cast), 0) + unknown (dotted (dated (S, 0, dot in the form of time)) as Float, 0) + ins (cast ( Dated (s, 0, cast (forms of time) As the switch to Friday)), 0) + Isnull (as a celebrity)) HTML>
Comments
Post a Comment