Max Date By Training code - Crystal XI
Max Date By Training code - Crystal XI
(OP)
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.
RE: Max Date By Training code - Crystal XI
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: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?
RE: Max Date By Training code - Crystal XI
Thanks for your help!
RE: Max Date By Training code - Crystal XI
What is your actual SQL code used as the data source of your report ?
Hope This Helps, PH.
FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?