Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Max Date By Training code - Crystal XI

Status
Not open for further replies.

swhiteside

Technical User
Sep 8, 2014
4
0
0
US
I have a report that has a column for a Training Code, I then have three date columns: Start Date, Req Date, and Exp Date. I have the report set so it will select distinct records only, however, the employee may have taken the training years ago and the code and date show up. I am getting duplicate training codes because they are in date order, I would like to have the Training Code to show up once with the most recent date.
 
A starting point:
SELECT A.*
FROM yourTable A INNER JOIN (
SELECT TrainingCode, MAX(StartDate) AS MaxDate FROM yourTable GROUP BY TrainingCode
) B ON A.TrainingCode = B.TrainingCode AND A.StartDate = B.MaxDate

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I am fairly new to crystal and not very tech language savvy. Currently I have one Group on my report, and it is by employee. So while the info provided above looks like it would work, I am still not sure how to accomplish the coding provided. It seems to me that I need to create a group based on the training code and go from there. I am not really wanting to create any more groups because they like the way the report looks now.

Thanks for your help!
 
You asked in the ANSI SQL forum, so I provided you an SQL code that does what you want without any Crystal stuff.
What is your actual SQL code used as the data source of your report ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top