Row number

Row numbers without partitions

Row numbers with partitions

Delete All But Last Record 1 to Many Table