Bad title - not sure of the best way to explain this in one short sentance!
I have to load in a lot of records that have the same identfiers but different versions:
City Supplier ContractNo
A 1 1
A 1 2
A 1 3
A 2 1
In some of my charts I only want the records from each sequence that have the highest contract number to be used (in the case above it would be A/1/3 and A/2/1 records). For other charts I need all instances to be used.
What is the simplest way of identifying which record is the last in the appropriate sequence? I thought about creating a separate table in my script of City/Supplier/Max(ContractNo) and then re-joining that back to my Contracts fact table somehow, but not sure how that would work.
Looping through each record in the table and checking all other records? Seems expensive over a couple of million records...
I think I can solve this, but probably not in the most elegant of ways!