Get top value from each group of sorted query

  • Thread starter Thread starter ryan.d.rembaum
  • Start date Start date
R

ryan.d.rembaum

Hello,

I have not seen anything that describes exactly what I am trying to do
(one person's question hit it on the head but had no answer).

I basically have list with many columns. I have sorted this list so
that all ID's are grouped together and so that the first record in each
grouping is the one I want. I need every single FIRST record from the
grouping.

The only way I can think to accomplish this is to insert my newly
sorted query into a table with a random seed column, then do a group on
the ID field and select the minimum from the SEED column. I could
then join that result set back to the original table. This seems sort
of kludgy to me however. It seems there should be a more
efficient/easier way.

Does anyone know of one?

Thanks,
Ryan
 
Since this is a Report news group, you might consider grouping and sorting
as you want and add a text box to the Detail Section:
Name: txtCountGroup
Control Source: =1
Running Sum: Over Group
Visible: No
Add code to the On Format event of the Detail Section:
Cancel = Me.txtCountGroup >1
 
Back
Top