The file I'm having to extract from was itself created by one of those dinosaurs, which unfortunately I cannot modify.
However, I do wish I'd contemplated a second dinosaur before going down the SQL road, as I think it might have already been written by now.
When I started, my DSI used to make me recite the whole cycle until all its details were learnt by heart.
-----Message d'origine-----
De : midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] De la part de Colpaert, Peter
Envoyé : mercredi 6 août 2008 11:16
À : Midrange Systems Technical Discussion
Objet : RE: SQL : subtotals and total
David,
If you're open to a solution that's not using SQL, I think there are some dinosaurs that would suggest using the RPG cycle for this.
I've heard that it's very good with (sub)totals and stuff like that.
Disclaimer: I've never used the cycle in my entire IT career.
Peter Colpaert
Software Engineer, Consumer Luminaires
Industrieterrein Satenrozen 11, 2550 Kontich, Belgium Tel. +32/ 3 450 74 09, Fax +32/ 3 450 74 33, Internal 1317 peter.colpaert@xxxxxxxxxxx, www.philips.com
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-
bounces@xxxxxxxxxxxx] On Behalf Of David FOXWELL
Sent: woensdag 6 augustus 2008 11:03
To: midrange-l@xxxxxxxxxxxx
Subject: SQL : subtotals and total
Hi,
I have the feeling this has been answered already but I can' t find it.
I have to produce the following :
ID Product Level Total
I've created a view that does select sum (number) as total with group
by ID, product, level, etc.
This gives a total for each level of a product.
I also have to add the total of all the levels so I've created a view
over my first view to do this.
My final table would look like this :
ID Product Level Total
1 A 1 2
1 A 2 6
1 A 8
To get there I'm creating the first view, then a second on that view,
then doing 2 inserts based on those views.
Its all looking very messy.
I think there is a way to produce subtotals and an overall total with
the OVER clause.
Does anyone know if this is possible to do?
Thanks
The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.