Reverse Duplicate

How to delete reverse duplicate in oracle.
e.g i/p
col1 col2
hyd blr
mum del
del blr
blr hyd
blr del
i want in o/p
col1 col2
hyd blr
mum del
del blr

Questions by ankita_sri

Showing Answers 1 - 3 of 3 Answers

raul

  • Sep 21st, 2015
 

Code
  1. SELECT DISTINCT T1.col1, T2.col2 FROM table T1, table T2 WHERE T1.col1 <> T2.col2 AND T1.col2 <> T2.col1

  Was this answer useful?  Yes

manish

  • Feb 7th, 2017
 

SELECT a.mem_name,a.loc_name
FROM TAB4 a
WHERE a.loc_name <= a.mem_name
UNION
SELECT a.loc_name AS mem_name ,a.mem_name AS loc_name
FROM TAB4 a
WHERE a.loc_name >= a.mem_name;

  Was this answer useful?  Yes

Priyanka Jaiiswal

  • Aug 17th, 2017
 

SELECT a.col1 ,a.col2 from t1 a
where a.col1 < = a.col2

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions