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

Popular posts from this blog

PHP while loop dynamic rowspan -

android - How to read a column value in parse.com without accessing an object or a pointer -

timer - Java TimerTask cancel -