Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SUM of an function result

Author  Topic 

hicham4
Starting Member

5 Posts

Posted - 2012-01-20 : 10:31:16
Hi Gents,

I have a problem, I try to retrieve the sum of the result of a function with parameters within select here is my query :


select userid,
C.CategoryName
,(select SUM([CalculateHours](TD.StartTime , TD.StopTime)) from [CalculateHours](TD.StartTime , TD.StopTime)) as 'aantaluren'
from Table1 as TD
join Table2 as TC on TD.ID = TC.Table1ID
join Table3 as C on TC.Table3ID = C.ID
where 'condition 1' and 'condition 2'
group by userid,C.CategoryName


If i'm wrong please don't hesitate to correct me
CalculateHours is a function who gets 2 parameters start- and stoptime and returns only workinghours.

Thanks a lot for your help/suggestions.

Hicham.

X002548
Not Just a Number

15586 Posts

Posted - 2012-01-20 : 11:33:17
[dbo].[CalculateHours]

????



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page
   

- Advertisement -