oracle - SQL query to Remove Duplicate data of specific type from table -
i given next table:
col1|col2 hyd |bag kol |chi del |pat handbag |hyd
i need maintain
kol |chi del |pat
and need maintain either of given row i.e:
hyd |bag handbag |hyd
i tried query:
select * test_kafee (select count(*) test_kafee b a.temp1 = b.temp2 , a.temp2 = b.temp1 ) = 0
which give unique one, duplicate not able stop 1 query:
select * test_kafee3 (select count(*) test_kafee b a.temp1 = b.temp2 , a.temp2 = b.temp1 ) > 0
table may contain more 1 duplicate, this: col1|col2 hyd |bag kol |chi del |pat handbag |hyd chi |kol
you want unique combinations in table.
select col1, col2 table1 col1 <= col2 union select col2, col1 table1 col2 < col1
union
remove duplicates you.
sql oracle
No comments:
Post a Comment