December 12, 2006 at 9:16 am
Looks like first he is deleting anything with a row_number > 1 (since we're partitioning by value this will give you a result set something like:
RegionID | RN
1 1
2 1
3 2
4 2
5 4
etc.... So we know that anything with a RN thats not 1 is a dupe. So the first delete takes care of those and the second goes back and deletes all the records in the Schools_Regions mapping table that doesn't have a corresponding RegionID in the Regions table, therefore eliminating all orphaned records... Which is basically what you said, no Ninja? What don't you get? Or maybe its me thats not getting something about what he's trying to do? (quite possible)
Viewing post 16 (of 15 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy