0

Hi

i try to sum two column in Sql, but don't get it....

this way is not working....

sum(SUM(DISTINCTDATEDIFF(mi, dbo.WORK_HISTORY.WORK_BEGIN_TIME, dbo.WORK_HISTORY.WORK_END_TIME))+
sum(distinct datediff(mi, dbo.work_history.work_begin_date, dbo.work_history.work_end_date))) ,

and with that is not working to

SUM(DISTINCTDATEDIFF(mi, dbo.WORK_HISTORY.WORK_BEGIN_TIME, dbo.WORK_HISTORY.WORK_END_TIME)) as A ,
sum(distinct datediff(mi, dbo.work_history.work_begin_date, dbo.work_history.work_end_date)) as B, sum(A+B) as Result

can someone help me please... Thanks

2
Contributors
7
Replies
8
Views
11 Years
Discussion Span
Last Post by dirtsch
0

ok, let's start from scratch. give me a brief description of what exactly you are trying to accomplish. including field types and names

something like
I have three columns: workerid, begin_time and end_time
I want to know the total time that a worker with workerid X worked during june
Or I want to know how many how many different workers worked on june 15th.
etc

0

ok, let's start from scratch. give me a brief description of what exactly you are trying to accomplish. including field types and names

something like
I have three columns: workerid, begin_time and end_time
I want to know the total time that a worker with workerid X worked during june
Or I want to know how many how many different workers worked on june 15th.
etc

hi,

Ok I try to descripe my problem.

I have a User which work for a someone and he have to raport the time he worked. The bad thing in this database is, that the time and the date is saved in a different field.

So he worked on the 06/19/2006 from 10:00 am until 06/21/2006 07:00 am. At least I want to find out, how many hours he worked.

in the database it looks like this:

User : xxxx
work_begin_time 2006-06-23 10:00:00
work_begin_date 2006-06-19 02:00:00
work_end_time 2006-06-23 07:00:00
work_end_date 2006-06-21 02:00:00

Now I thought, that I could count the differenc between the time and the date and count this two results together.

can you help me ?

thanks

0

Yes it's definitv out of question. :-) yes I need minutes...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.