Free Backlinks Generator

Sep 12, 2011

MySQL DISTINCT to Remove Duplicate Listing

How to select and display records from MySQL table using the DISTINCT keyword for unique data.

This is for removing duplicated results in order to gain unique listings from your database table using the DISTINCT keyword in your MySQL select statement.





For example if you ran this:

Select Cars FROM Cars_Listing
======== Results =======
BMW
BMW
HONDA
BENZ
BENZ
BMW
FORD
FORD
=======================
 
Notice how there is more then one BMW.
Here is how to clean up that result by using the DISTINCT keyword in your MySQL select statement

Select DISTINCT Cars FROM Cars_Listing
======== Results =======
BMW
HONDA
BENZ
FORD
=======================

0 comments:

Post a Comment