Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Only filtering on the max ID within a group Post Reply Post New Topic
Author Message
foxy
Groupie
Groupie
Avatar

Joined: 12 Jul 2007
Online Status: Offline
Posts: 50
Quote foxy Replybullet Topic: Only filtering on the max ID within a group
     Posted: 30 Nov 2010 at 10:37pm
Hi All,

I have a scenario similar to the attached image
 


As you can see, each record in Table1 can have multiple rows in Table2. I have specific date filters that I apply to the start and end dates in Table2, but I only want to apply these filters to the maximum Table2.ID for each record in Table1. I have tried to do this in the select expert, but I get an error saying that it must be evaluated later. Is this possible?

Many Thanks,
Chris < =text/>

FOXY
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 01 Dec 2010 at 3:23am
try a stored procedure.  you can perform multiple sql commands there, not just 1 select.
 
CR can't do it, as the MAX function is an aggregate, and is not evaluated in the 2 passes through the data the CR performs before display.
 
If it is just a display issue, you could suppress all the rows that don't match the desired value (max()).  If you want to use aggregates, like SUM on the data, you would need to code your own running totals via formulas or running totals as SUM will will include all the values you supressed as well as the ones displayed.
 
HTH
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum