Problem SOLVED!
Update:
Not quite right what I need, lets do example on simple table with fields ID,NAME,COVER
I have got 100 entries with 100 names, some of the names are duplicated, but I want only update first one from duplicates.
Trying to update all the 1st rows from all the duplicates in database, really hard to do it, any idea how I can make it? Below is the code I am trying to rebuild, but this code replace every 1st one with the last one for all the duplicates.
Schema, how I want it work below
ID NAME COVER
1 Max 1
2 Max 0
3 Andy 1
4 Andy 0
5 Andy 0
UPDATE table t
JOIN (
SELECT MinID, b.Name LatestName
FROM table b
JOIN (
SELECT MIN(ID) MinID, MAX(ID) MaxID
FROM table
GROUP BY tag
HAVING COUNT(*) > 1
) g ON b.ID = g.MaxID
) rs ON t.ID = rs.MinID
SET t.Name = LatestName;