Dear Kristinaloupe,
Ok. Good information.
However, in the data presented above I see no repetition of Event ID per vbkey.
Regardless, if the goal is simply to show the last date for an Event ID you could Group by VBKey, Group by Event Number, Group by Event ID and then display the data in the group footer. (you may need to add a sort for event date ascending). This would show the max date. If you need the max date regardless of event number then leave it out of the grouping.
If you don't want to select the records at all that aren't equal to the max date then create a sql expression. (View/Field Explorer/SQL Expression/New and give it a name)
then write something like the following, of course correcting for your actual table/view names... )
Code:
(Case when
(Select P.[Event Date]
from
"Owner."MyTable" P
WHERE
P.[VB Key] = "ReportTable"."VB KEY"
AND
P.[Event ID] = "ReportTable"."Event ID"
)
=
(Select Max(T.[EVENT DATE)
FROM "Owner."MyTable" T
WHERE
T.[vb key] = "ReportTable"."VB KEY"
AND
P.[Event ID] = "ReportTable"."Event ID")
then 1
else 0
end
)
Then in your selection criteria you would add:
{%NameofExpression] = 1
That should only return records where the date for the event id for vbkey is the max.
I hope that helps.
ro
Rosemary Lieberman
rosemary-at-microflo.com,
Microflo provides expert consulting on MagicTSD and Crystal Reports.
You will get answers more quickly if you read this before posting: faq149-3762