May 13, 200817 yr hello again... i have a portal showing 100s of records for 100s of patients. but i only want to show the last two records for each patient. i don't want to keep these records in DB aswell [except the last 2 for each patient]. so i want to know how can i delete these records from db, leaving only the last two records for each patient. i was thinking whether looping through records for each patient and delete them one by one will be a possibility? or is there some other easy way to achieve it? i only want the last/latest two records and nothing of the rest. PS: records are being displayed in a portal. thanx. Edited May 13, 200817 yr by Guest
May 14, 200817 yr You should go to the PatientActivity records and delete from there. You can have a script sort the records by date and then have a loop delete for duplicates. There are lots of posts on here on how to delete duplicates with a loop. All you would have to do is adjust it so that it does not delete when the count of a self join is < 3.
Create an account or sign in to comment