Thank you,
I tried the code on my table:
SELECT EMPID,
CONVERT(VARCHAR,Min(CONVERT(DATETIME,EffectiveDate)),107) AS StartDate,
PrimaryRater,
CONVERT(VARCHAR,MAX(CONVERT(DATETIME,EffectiveDate)),107) AS EndDate
FROM ReportingTable
GROUP BY
EMPID,
PrimaryRater
I received the following results:
EMPIDStartDate PrimaryRater EndDate
12345Jul 17, 1966 A12345 Jul 12, 2013
12345Jan 01, 1966 B12345 Jan 01, 1966
I think the only piece missing is this. I would like the StartDate to be the EndDate for the Previous Primary Rater.
Like this:
EMPIDStartDate PrimaryRater EndDate
12345Jul 17, 1966 A12345 Jul 12, 2013
12345Jan 01, 1966 B12345 Jul 17, 1966
This will provide a sequential history of all PrimaryRater, EffectiveDate combinations.
How would I achieve this?