We are trying to remove duplicates from our data set before we make the jump to a new system. The idea is to move all the data from the newer duplicate student to the original. We wrote a script that automatically moves all the information over but we're still trying to figure out how to optimize it and only move certain parts over. Each student has a school and sometimes the duplicates have the same school which is unnecessary. The school information is all in one table and we just update the parent_id to move the new to the old. How do we get it so that the transfer only takes the non-duplicate schools and since each is tied to a date, we want to make sure we keep the original if their is a duplicate school. What can we do?
Asked
Active
Viewed 43 times
0
-
One way is to do this in 2 steps - 1. Create a list of duplicates using cte and then 2. use this list to update or delete the duplicated records using this list. Search for finding duplicates and cte. It should help if you tagged your question with the database you are using. – sibert Jul 26 '17 at 15:26
-
If the answer below solved your problem, could you please mark it as accepted? Thanks – Eedoh Jul 26 '17 at 15:44
-
Possible duplicate of [How to delete duplicate rows in sql server?](https://stackoverflow.com/questions/18390574/how-to-delete-duplicate-rows-in-sql-server) – BSMP Jul 27 '17 at 03:10
1 Answers
2
You don't necessary need to update. You could do a delete.
Check out the answer to this question

Eedoh
- 5,818
- 9
- 38
- 62
-
Rather use the "Share" option for answers like these. It tracks all the parties. – Anthony Horne Jul 27 '17 at 06:37