jeudi 5 février 2015

how to update duplicate rows in a column to a new values


Vote count:

0




I will explain my problem briefly


have duplicate rino like below (actually this rino is the serial number in front end)



chqid rino branchid
----- ---- --------
876 6 2
14 6 2
18 10 2
828 10 2
829 11 2
19 11 2
830 12 2
20 12 2
78 40 2
1092 40 2
1094 41 2
79 41 2
413 43 2
1103 43 2
82 44 2
1104 44 2
1105 45 2
83 45 2
91 46 2
1106 46 2


here in my case I don't want to delete these duplicate rino instead of that I planned to update the rino having max date(column not specified in the above sample actually a date column is there) to the next rino number


what exactly I meant is :


if I sort out the above result according to the max(date) I will get



chqid rino branchid
----- ---- --------
876 6 2
828 10 2
19 11 2
830 12 2
1092 40 2
79 41 2
413 43 2
82 44 2
83 45 2
1106 46 2


(NOTE : total number of duplicate rows are 10 in branchid=2)



  • the last entered rino in the table for branchid=2 is 245

  • So I just want to update the 10 rows with numbers starting from 246 to 255( update according to chqid)



asked 26 secs ago







how to update duplicate rows in a column to a new values

Aucun commentaire:

Enregistrer un commentaire