dervaish Posted May 13, 2008 Posted May 13, 2008 (edited) 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, 2008 by Guest
mr_vodka Posted May 14, 2008 Posted May 14, 2008 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.
Recommended Posts
This topic is 6089 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now