× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Peter,

You don't know what you've missed...

Jonathan

Colpaert, Peter wrote:
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.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.