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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select Only Newest Date 1

Status
Not open for further replies.

ddpleasant

Programmer
Sep 23, 2004
2
US
I am running Crystal Reports V8.5 on a Windows NT box. Need a way to elliminate duplicate records and keep only those with the highest EnterDAteTime. I am trying to create a Benefits Report that shows for each employee the following table:

EmpId EmpName HireDate BenStrtDt EmplyePay EmplyrPay
0001 J Smith 08/24/03 08/24/03 62.50 128.30
0002 A Smith 01/24/03 05/14/03 62.50 128.30

Because there are incorrectly entered duplicate records in the table I get Duplicates as such.

EmpId EmpName HireDate BenStrtDt EmplyePay EmplyrPay
0001 J Smith 08/24/03 08/24/03 62.50 128.30
0001 J Smith 08/24/03 08/24/03 62.50 128.30
0002 A Smith 01/24/03 05/14/03 62.50 128.30
0002 A Smith 01/24/03 05/14/03 62.50 128.30


The only field that is different is EnterDateTime. So I need to retain only those records in each case wherre it is the MAX(EnterDateTime).

Please advise.

Thank you!
 
Group on something like EmpId. Use [Sort Records] under [Reports] to put them into date-time order, ascending or descending. If you then suppress details and show date/time in the header and footer, this will be minimum and maximum. Use whichever suits you.

Running totals can be set to sum just once per group, or to use a formula that tests the date/time against the maximum for that group.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top