In your load script sort the table in descending order by package, date, time.
Load * from Package
order by PackageID , Date, Time desc
Then add something like this to get the results out of your sorted table:
if(Previous(PackageID) = PackageID, 'Old', 'Most Recent') as RecentFlag,
It is critical that you sort the table in descending order or the previous expression will flag the 1st instance of a package not the last.
Sorry my bad, order by only works on resident tables. Probably more efficient ways to do it but this works...
load * from TRACKING_DATA_TEST.qvd;
Load * resident tracking_temp
order by [TRCK#] desc, LAST_STATUS_UPDATE desc;
drop table tracking_temp;
if(Previous(PackageID) = PackageID, 'Old', 'Current') as CurrentFlag,
drop table tracking_temp_2;
Here is another working solution. You may modify the script depending on the need.
Hope this helps.
Test_20110611a.qvw 140.8 K