Unable to detect duplicate using mysql and rename the string -
i have schema account follows :
accountid | filename
if filename repeats want store as:
filename.txt filename1.txt filename2.txt filename3.txt
i doing checking number of duplicates running query check number of duplicates , renaming filename in backed , running insert query.
can whole procedure can done in 1 query ?
you can in single query:
select t.id, t.account, z.dupcount filename join (select account, count (*) dupcount filename group account having count(*) > 1) z on z.account = t.account order dupcount desc
Comments
Post a Comment