I have a tbltransaction with uniquekey, transactioncode,weight. There may be multiple transaction codes for each uniquekey.
Each transactioncode has a weight. I need to create a new table that shows the uniquekey, transactioncode and the lowest weight for that key.
The final table would containe the uniquekey transactioncode and the weight. The unique key will appear 1 time and sample out put follows.
uniquekey transactioncode weight
689291300 1234 1
689291300 3456 16
689291300 7638 3
689291301 4850 8
689291301 4859 15
returning values
uniquekey transactioncode weight
689291300 1234 1
689291301 4850 8
I have tried various queries (Min) etc with mixed and inconsistent results. My table may contain up to 1,000,000 records so I am thinking a nested loop in a visual basic routine but just I haven't been able to figure out the right sequence. Thanks for the help.
Open in new window