Hi!
I'm hoping someone can help with this as I am at the end of my tether!
I have a table that contains patient data and each record has a cost attached to them. By looking at the patient ID, the date they were admitted and their treatment I have created a unique ID that can identify those patients who were seen more than once on the same day. However, where there is more than one record the costs for treatment can be different and so we just want to pull out a list of those with the lowest cost. I have tried using the min function, but am not getting the results I expect because there are several duplicate pairs. The current data looks something like this:
UniqueID Tariff
200510254081332436501 518.7900
200510254081332436501 911.3000
200511074100033451303 373.3600
200511074100033451303 3705.8100
200510164140524308501 518.7900
200510164140524308501 1399.3700
But I would like to see just the minimum from each pair:
UniqueID Tariff
200510254081332436501 518.7900
200511074100033451303 373.3600
200510164140524308501 518.7900
Sorry for such a long query, but can anyone help?
Many thanks in advance,
Nik
I'm hoping someone can help with this as I am at the end of my tether!
I have a table that contains patient data and each record has a cost attached to them. By looking at the patient ID, the date they were admitted and their treatment I have created a unique ID that can identify those patients who were seen more than once on the same day. However, where there is more than one record the costs for treatment can be different and so we just want to pull out a list of those with the lowest cost. I have tried using the min function, but am not getting the results I expect because there are several duplicate pairs. The current data looks something like this:
UniqueID Tariff
200510254081332436501 518.7900
200510254081332436501 911.3000
200511074100033451303 373.3600
200511074100033451303 3705.8100
200510164140524308501 518.7900
200510164140524308501 1399.3700
But I would like to see just the minimum from each pair:
UniqueID Tariff
200510254081332436501 518.7900
200511074100033451303 373.3600
200510164140524308501 518.7900
Sorry for such a long query, but can anyone help?
Many thanks in advance,
Nik