× 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.



Listers,

Ok, I have beat my head against the wall enough on this, time to consult the
experts. It should be easy, but ..

I also thought this was covered before and in the archives, but have not yet
located that thread.

I have the following fields; a date, an amount and a number. What I want to
get is a list that has a count and total in each month and year by the
number, kind of like this;

Number Year Month Count Total amount
001 1999 11 05 99.99
001 1999 12 02 999.99
002 1999 11 01 200.01
002 2001 06 55 1234.56
.
.
.
Etc.

I have the following code, but I know it is wrong, as it produces only
totals per number, and not per year and month within number;

SELECT Number_Field,
Year(Date_Field) AS Year_Field,
Month(Date_Field) AS Month_Field,
count(Number_Field) AS Num_Occurances,
Sum(Amount_Field') AS Total_Amt
from SomeLib/SomeFile
group by 1 asc, 2 asc, 3 asc
order by 1, 2, 3

Can anyone see what I am doing wrong? Give me a little guidance? Am I
going to have to use a qmqry and a form to get the breaks by number - year-
month that I want?

Thanks!

Jim Essinger
Senior Programmer/Analyst
SQL novice, but learning!

208-452-9475

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.