0

I've got a multiple fields Primary Key that consists of (col1,col2,col3). However, before the PK was added, there have been a lot of duplicates added which need to be removed.

So for my table if I have:

Col1 Col2 Col3
---- ---- ----
  2    3   3
  2    3   3
  2    3   4
  2    4  null
  2    4  null

the query should result in

 Col1 Col2 Col3
 ---- ---- ----
  2    3   3
  2    3   4
  2    4  null

Only 3rd column is nullable.

Fofole
  • 3,398
  • 8
  • 38
  • 59

1 Answers1

0

use distinct

select distinct col1, col2, col3
from tablename
Fahmi
  • 37,315
  • 5
  • 22
  • 31