clear markdown compare help best fiddles feedback dbanow.uk
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 2591684 fiddles created (45707 in the last week).

CREATE TABLE [dbo].[Time]( [GUIDEmployee] int NULL, [Date] [datetime] NOT NULL, [Hours] [decimal](18, 2) NOT NULL);
 hidden batch(es)


INSERT INTO [dbo].[Time] VALUES ( 1 , '2012-03-02', 2.00), ( 1 , '2012-03-02', 4.50), ( 1 , '2012-03-19', 1.50), ( 1 , '2012-03-19', 1.50), ( 1 , '2012-03-12', 2.00), ( 1 , '2012-03-16', 4.50);
6 rows affected
 hidden batch(es)


SELECT [GuidEmployee], [Date], [Hours], SUM([Hours]) OVER(PARTITION BY GuidEmployee,[Date]) as total_hours FROM [dbo].[Time];
GuidEmployee Date Hours total_hours
1 02/03/2012 00:00:00 2.00 6.50
1 02/03/2012 00:00:00 4.50 6.50
1 12/03/2012 00:00:00 2.00 2.00
1 16/03/2012 00:00:00 4.50 4.50
1 19/03/2012 00:00:00 1.50 3.00
1 19/03/2012 00:00:00 1.50 3.00
 hidden batch(es)


SELECT [GuidEmployee], [Date], SUM([Hours]) FROM [dbo].[Time] GROUP BY [GuidEmployee],[Date];
GuidEmployee Date (No column name)
1 02/03/2012 00:00:00 6.50
1 12/03/2012 00:00:00 2.00
1 16/03/2012 00:00:00 4.50
1 19/03/2012 00:00:00 3.00
 hidden batch(es)