Reputation: 1901
I have table named x
Here is the sample data in table x
Column1____________ Column2______________ Column3
a ___________________ b______________________c
a2__________________b2______________________c
a3__________________b3______________________c2
a4_________________b4_______________________c3
The result I need in a new table is:
Column1____________ Column2______________ Column3
a3__________________b3______________________c2
a4_________________b4_______________________c3
I tried importing the values to a new table and applying a unique index on column 3 but the result i get out of it is
Column1____________ Column2______________ Column3
a__________________b______________________c
a3__________________b3______________________c2
a4_________________b4_______________________c3
Upvotes: 3
Views: 247
Reputation: 14927
SELECT * FROM x WHERE Column3 NOT IN
(SELECT Column3 FROM x GROUP BY Column3 HAVING COUNT(*) > 1)
Upvotes: 4