How to select distinct multiple columns in MySQL and Oracle database?
(Also works with PostgreSQL)
-
How to Select Distinct Multiple Columns in MySQL and Oracle Database?
smallwei
How to select distinct multiple columns in MySQL and Oracle database?
(Also works with PostgreSQL)
smallwei 7:53 pm on November 15, 2009
Essentially there are two ways to do it:
1. Use SELECT DISTINCT
SELECT DISTINCT a,b,c FROM table2. Use GROUP BY
SELECT a,b,c FROM table GROUP BY a,b,c