Jump to content

Search Most Recent Record In Each Group of Records


dtsparky

This topic is 6160 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have numerous banana records each with a different date, numerous apple records each with a different date, numerous orange records each with a different date, etc.

How can I create a quick search that finds the most recent record for each catagory based on the date field, i.e. the most recent banana, most recent apple, etc.

Thank you

Link to comment
Share on other sites

It is possible you would just have to script a find for each category then go to the last record......Mark it....Then find the ones you marked. The end of the script would unmark the records so you don't find them later.

Could become really tedious though if you add a lot of different categories though.

HTH

Link to comment
Share on other sites

The easy way is to have a table of Categories, with each Category record showing data from the last related record in your current table.

Another option is to sort your records by Category and by Date (ascending). Then go to the first record, and omit the number of records in that category minus one. Move to the next record and repeat. Exit the loop when you land on the last record in the found set. However, this is a rather advanced technique that I wouldn't recommend to a beginner.

Link to comment
Share on other sites

The table of Categories also gives you the ability to have a CategoryID. Then if someone says, let's change Apple to McIntosh, you don't have to update the other table's records, since they have the correct CategoryID key stored.

Link to comment
Share on other sites

This topic is 6160 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.