Question: I want to find the duplicates of two columns in the same table. 

Example data set is as follows.

```
Column_1              Column_2

**15440100000220**  15440300002980

15440100000150  **15440100000220**

15440100000170  **15440300002160**

**15440300002160**  15440100006170

```

As you can see, I have duplicates in the two columns. Records in the first column are present in the second column and records in the second are present in the first. 

I looked for a solution but only came across examples comparing duplicates of two tables.

Is there a way to get these duplicates into a select query? If a record in column 2 is present in column1, then that record in column 2 should be captured in the query.

Answer: 
Another approach to just list the `column_2` values that also appear in `column_1` is to use `exists`:

```
select column_2
from your_table yt
where exists (
  select null
  from your_table yt2
  where yt2.column_1 = yt.column_2
);

```

I think the intent of this is clearer, but you should check the performance of the various approaches.
You just want those duplicated id's? Do a self join:

```
select distinct t1.column_1
from tablename t1
join tablename t2 on t1.column_1 = t2.column_2

```