Aggregate calculation grouping by

Mark123

New Member
Hi,

I am new to Progress and trying to create a progress code for the following SQL analogy:

select
pp_acct_rep,
counts = count(*)
from
tt_mismatches
group by
pp_acct_rep
order by
pp_acct_rep

Here is what I am trying to code, but every time I get a wrong result :

for each tt_mismatches break by pp_acct_rep:
accumulate pp_acct_rep (sub-count)
end.

display
pp_acct_rep (accum sub-count pp_acct_rep) skip.


Apparently I am missing something ? Any help please.
 

tamhas

ProgressTalk.com Sponsor
What you are missing is that your display is coming after you have already been through all the records. You need to move the display inside the loop and use LAST-OF() to tell when you are at the end of a group.
 
Top