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!

greatest date

Status
Not open for further replies.

bzsurf03

MIS
Dec 13, 2002
75
0
0
US
I am dealing with a set of data that has an autonumber for the primary key. This number actually represents a date which is also in the same table. I want a report that only shows information about the latest date, which would be the greatest auto number. How would I go about doing this?
 
sort it descending by date? put a count of records and suppress anything greater than 1?
 
It depends on your data.. if you only have a few items per whatever it is that you are looking for.. then add a group, sort descending by the id and only display your data in the header (ie only the first record in the group).

If you have a lot of records that you only want one of, add a subquery to your select statement manually to only return the highest date:

table.date = (select max(t.date) from table t where t.identifier = table.identifier)

where identifier is the (probably foreign key) field you would be grouping on, such as customerId etc.

Lisa
 
You can also achieve this by using your Group Selection Criteria. Access the Report menu/Edit Selection Menu/Group, and enter the equivalent of:

{YourDate} = Maximum({YourDate})

Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top