|
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Antonio
Fernandez-Vicenti
Sent: Friday, July 06, 2007 2:55 AM
To: Midrange Systems Technical Discussion
Subject: Re: SQL summary qry
Jim, Vernon and Birgitta, let me enter this thread since I'm
interested in an additional detail:
Apart from the comments about using names, asc/desc, etc...
Can you get the grouping at, say, two or more levels of grouping?
I mean, (grouping) giving totals for, at
number_field/year/month level, as in Vern's SELECT sentence,
... PLUS ...
PLUSand also higher level (number_field/year , and
number_field) Totals in same SELECT in an "interspersed"
(did I spell it right?) way as shown below.
Note: I've edited results with blank lines in between and
horizontal displacements at different level totals just to
make things more clear, but that would not be needed , of course!
Number Year Month Count Total amount
001 1998 11 xx 99.99
001 1998 12 xx 999.99
001 1998 1099.98
001 1999 11 xx 99.99
001 1999 12 xx 999.99
001 1999 1099.98
001 2199.96
002 1999 11 01 200.01
002 1999 06 55 1234.56
002 1999 1434.57
002 1434.57
TIA,
--------------------------------------------------------------
--------------------------------
Vernon Hamberg wrote:
select number_field,--
year(date_field) as year_field,
month(date_field) as month_field,
count(*) as num_occurrences,
sum(amount_field') as total_amt
from somelib/somefile
group by number_field, year(date_field), month(date_field)
order by 1, 2, 3
Antonio Fernandez-Vicenti
afvaiv@xxxxxxxxxxxxxx
--
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.
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.