Home / mySQL / Mysql Remove Duplicate Data or Rows With DISTINCT

Mysql Remove Duplicate Data or Rows With DISTINCT

How do I remove duplicate data or rows from a MySQL query?

If output from a MySQL query contains duplicate data or row and if you would like to remove the same use DISTINCT.

DISTINCT combined with ORDER BY needs a temporary table in many cases. Consider following query:
mysql> SELECT firstname FROM registration;




If you need unique firstname i.e remove duplicate contains type the command:
mysql> SELECT DISTINCT firstname FROM registration;

You can use DISTINCT with multiple column as follows:
mysql> SELECT DISTINCT firstname, city FROM registration;

Loading Facebook Comments ...
Social Media Auto Publish Powered By : XYZScripts.com