My DOCUMENT table has duplicate entries when I group BY name, size
The result of this query is
SELECT name, COUNT( * ) , id,filename FROM DOCUMENT GROUP BY name, size HAVING COUNT( * ) >1
name COUNT(*) id filename
--------------------------------------------------------------
docu1 45 33 fname1
docu2 85 59 fname2
docu3 43 33 fname5
I want to change the "filename" of all recurring entries to the filename of the first entry of the group. (That means the first record of the group will be unchanged)
Can any body help me,
Thank you so much
MySQL Server
Last Comment
myyis
8/22/2022 - Mon
Gary
So where for example the ID is 33 all entries should be filename1 (not filename5 etc)?
myyis
ASKER
Like this
name size id filename
---------------------------------------------
docu1 10 33 fname1
docu1 10 34 fname4 change to fname1
docu1 10 35 fname6 change to fname1
docu2 20 36 fname7
docu2 20 36 fname8 change to fname7
Also I need to have the list of the old (changed) "filename" values ("fname4","fname6","fname8")