how to remove duplicates value in database table

Published on Author bloggerfiveLeave a comment

To remove duplicate value from the table is very simple. if it has primarykey that make more convenient.

The below query shows how to delete duplicate with maximum value.

        from db.task_table
        where taskId in (
        select * from (
                    max(taskId) as taskId
                    from db.task_table        
                    group by taskId
                    HAVING count(*) >1) A



Leave a Reply

Your email address will not be published. Required fields are marked *