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
 Showing Totals as well as details

Author  Topic 

dprichard
Yak Posting Veteran

94 Posts

Posted - 2007-05-14 : 18:22:19
This is showing the details I am looking for. Is there a way to show the totals for the clients for 418 and totals for 417?

SELECT     NAME.Nickname1, NAME_1.Nickname1 AS Expr1, SLPTRANS.ActyExpID, SLPTRANS.TimeSpent / 3600 AS Hours
FROM CUSTOMC INNER JOIN
NAME AS NAME_1 ON CUSTOMC.RecordIDQ = NAME_1.RecordID INNER JOIN
NAME ON CUSTOMC.ControllerQ = NAME.RecordID INNER JOIN
SLPTRANS ON CUSTOMC.RecordIDQ = SLPTRANS.ClientID
WHERE (NAME.NameType = 0) AND (CUSTOMC.Service_Cont = 'YES') AND (SLPTRANS.ActyExpID = '417') OR
(SLPTRANS.ActyExpID = '418') AND (SLPTRANS.StartDate BETWEEN @IncludeStartDate AND @IncludeEndDate)

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-14 : 18:27:31
And how do you calculate the "totals" ?


KH

Go to Top of Page

dprichard
Yak Posting Veteran

94 Posts

Posted - 2007-05-14 : 18:29:14
I am trying to get a grand total for the SLPTRANS.TimeSpent / 3600 AS Hours. It is listing the individual hours now for each slip, but I am trying to total them at the bottom for 417, then total them at the bottom for 418.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-14 : 18:44:09
Sounds like a job more suitable for the front end application rather than SQL


KH

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-05-15 : 09:25:05
quote:
Originally posted by khtan

Sounds like a job more suitable for the front end application rather than SQL


KH



Yes it is

dprichard, where do you want to show the data?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Jeff Moden
Aged Yak Warrior

652 Posts

Posted - 2007-05-15 : 19:27:33
I agree with the others... if an application is available, the totals should be done there. If not, take a look at ROLLUP and CUBE in Books Online.

--Jeff Moden
Go to Top of Page
   

- Advertisement -