Question : Crystal Report Selection Formula based on SQL Max(Date)

I am writing a Crystal Report that prints examination results for each student.  Each student may take an examination several times but the report must only show the latest examination result for each student.  
For example, a student may have sat the French exam three times and the Maths exam once.  There would be 4 SQL records as follows:
 examid  examdate        result
100        12-07-2007     34
100        14-11-2007     39
100        10-07-2008     48  
200         08-07-2007    65  
but the Crystal results report must show:
examid  examdate        result
100        10-07-2008     48  
200         08-07-2007    65  

In SQL I would use :
select * from examresults ex where examdate in
(select max(examdate) from examresults where examid = ex.examid)

Is this possible in Crystal?  I can't work out how to convert the above into Crystal's selection language.

Answer : Crystal Report Selection Formula based on SQL Max(Date)

You should be able to use that directly as a COMMAND when you assign the datasource.

Instead of selecting a table choose ADD COMMAND

If that doesn't work you can use groups
Group on the student then the examid
Sort by the date descending
You can display the information in the exam group header
Supress the details and group footer

mlmcc
Random Solutions  
 
programming4us programming4us