SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to make a Grand Total?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

djavet
Starting Member

36 Posts

Posted - 06/22/2005 :  10:52:25  Show Profile  Reply with Quote
Hello

I've a little question:
How could I add a Grand Total from my "sub_total_heures" into my query:

SELECT
succursales,
sub_total_heures = SUM(heures)
FROM
(SELECT
heures,
succursales = CASE
WHEN heures_sap.ctre_emet IN (124000) THEN 'Leitung, RC, SA'
WHEN heures_sap.ctre_emet IN (124100) THEN 'CSC'
WHEN heures_sap.ctre_emet IN (124200) THEN 'FM Fribourg'
WHEN heures_sap.ctre_emet IN (124300) THEN 'FM Valais'
WHEN heures_sap.ctre_emet IN (124400) THEN 'FM Vaud'
WHEN heures_sap.ctre_emet IN (124500) THEN 'FM Genève'
WHEN heures_sap.ctre_emet IN (124600) THEN 'FM Tessin'
WHEN heures_sap.ctre_emet IN (124900) THEN 'CNP'
ELSE 'Autres succursales' END
FROM heures_sap
where heures_sap.heures >= 0)t
GROUP BY succursales
ORDER BY succursales ASC


A lot of thx,
Dominique

dsdeming
Constraint Violating Yak Guru

USA
479 Posts

Posted - 06/22/2005 :  11:30:36  Show Profile  Reply with Quote
Have a look at Summarizing Data Using ROLLUP in BOL.

Dennis
Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22755 Posts

Posted - 06/23/2005 :  00:53:51  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=51449

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000