Hi, i have a problem in my database. how to sum the value of row into another value of row?.. i want to compute the total of Hoursworked.... this is my example table for the sum of row by row..

DTR Table
EmpID TimeIn TimeOut HoursWorked Date
1 08:30 05:30 9 1/1/2011

1 08:30 05:30 9 1/2/2011

1 08:30 05:30 9 1/3/2011

1 08:30 05:30 9 1/4/2011

1 08:30 05:30 9 1/5/2011


Table:
EmpID TotalHoursworked Date

1 45 1/5/2011

5 * 9 = 45

This is my problem how to get the (45) in fields TotalHoursworked?

please help...

select sum(HoursWorked) from DTR where EmpID = empid 
and date between date1 and date2

NOTE :-- avoid using Date as a column name in DB table, that is a reserved key word so you may face with unexpected results.

thankz.. "Salamat" means thank you...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.