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



How about

select Date, Name, count(*) from file
group by Date, Name
order by Date, Name

If you want the maximum of those counts, use a CTE

with tmp as (
select Date, Name, count(*) as slots
from file
group by Date, Name)
select max(slots) from tmp


Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx


-----Booth Martin <booth@xxxxxxxxxxxx> wrote: -----
To: RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
From: Booth Martin <booth@xxxxxxxxxxxx>
Date: 11/28/2016 07:51PM
Subject: SQLRPGLE - max count


This seems simple enough but it has me flummoxed.

I have a file with three fields of interest to me: Ordered by Date,
Name, Time. I want to know what is the maximum number of rows there will
be for every Date/Name group. What is the max number of slots I have
to allow for the various Times listed for each Date/Name group?



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.