SQL query to find duplicate rows, in any table in Mysql database -


i'm looking schema-independent query. query should equally capable of catching duplicate rows in either table in database.i have number of tables without primary key. have found result sql server [which have experience] looking same thing in mysql

use dynamic sql generate query using column information in information_schema:

set @tablename = 'yourtable'; set @sql = (     select concat('select *                     `', table_name, '`                    group ', group_concat(concat('`', column_name, '`')), '                    having count(*) > 1')     information_schema.columns     table_name = @tablename ); prepare stmt @sql; execute stmt; 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -