Wednesday, July 2, 2014

help on update Statement on SAME Rows

Another better option would be to eliminate the duplicate by updating all records with one of the segids (either max of min) like below



UPDATE t
SET CbsegId = MaxSegID
FROM (SELECT CbSegId, MAX(CbSegId) OVER (PARTITION BY RiverSegment) AS MaxSegID
FROM TblLandriverSegment)t





Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://ift.tt/19nLNVq http://ift.tt/1iEAj0c


No comments:

Post a Comment