|
-----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
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.