Help with row_number()

  • 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