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.
| Author |
Topic |
|
djavet
Starting Member
36 Posts |
Posted - 2005-06-22 : 10:52:25
|
| HelloI'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)tGROUP BY succursalesORDER BY succursales ASCA lot of thx, Dominique |
|
|
dsdeming
479 Posts |
Posted - 2005-06-22 : 11:30:36
|
| Have a look at Summarizing Data Using ROLLUP in BOL.Dennis |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-06-23 : 00:53:51
|
| http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=51449MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|