Link to home
Create AccountLog in
Avatar of ASPDEV
ASPDEV

asked on

DO SUM in SQL Server 2005

Hell Experts,

I have a table COMM,

Comm

EMpID      COMM        Datetime
------       --------        ----------------
101             10       10/01/2010 12:15 AM
102             10       10/01/2010 12:15 AM
101             50       10/01/2010 12:15 AM
101             10       10/02/2010 11:15 AM
102            50       10/02/2010  10:15 AM
101             10      10/02/2010    08:15 AM

I need SUM of COMM from COMM table for that EMPID and Update in another Table EMP

EMP
-----
EMPID    Date                 COMM
-------    --------               ----------
101       10/01/2010           60
102       10/01/2010           10
101       10/02/2010            20
102       10/02/2010            50

Note: I need sum for the whole Day, for each EMPID.

Avatar of Muhammad Ahmad Imran
Muhammad Ahmad Imran
Flag of United Kingdom of Great Britain and Northern Ireland image

select empid,sum(comm),datetime
from comm
group by datetime,empid
/
ASKER CERTIFIED SOLUTION
Avatar of cyberkiwi
cyberkiwi
Flag of New Zealand image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of ASPDEV
ASPDEV

ASKER

Thanks.