I would like to determine the most recent datemodified value from a series of tables that are used in my db. I would then like to display this date on a report so that at report time the user would know when the last modification took place.
All my tables are related with the PK of API. Some are 1 to many relationships. All tablenames are prefixed with "data_sometablename".
There are probably 20 tables.
I was thinking of some sort of nested loop where for each table in the DB with a name Like(data_*)select the API and datemodified fields,
Store the date value and in the case of a many type table find another record and compare the dates
store the most recent date then
Next Table
finally spit out the most recent datemodified value.
Or
Roll through all the Like(data_*) tables and collect the table name, API and datemodified
Store them in an array and find the most recent.
Any thoughts on the best way between the two methods or any other suggestions?
All my tables are related with the PK of API. Some are 1 to many relationships. All tablenames are prefixed with "data_sometablename".
There are probably 20 tables.
I was thinking of some sort of nested loop where for each table in the DB with a name Like(data_*)select the API and datemodified fields,
Store the date value and in the case of a many type table find another record and compare the dates
store the most recent date then
Next Table
finally spit out the most recent datemodified value.
Or
Roll through all the Like(data_*) tables and collect the table name, API and datemodified
Store them in an array and find the most recent.
Any thoughts on the best way between the two methods or any other suggestions?