I have a huge dataset with about 400,000 rows. I want to select only the rows where the value of the second column (val) exists in the third column (ecr) in the same table.
For example, in the sample screenshot shown below, the value of the column val on the second row (4294939057) is equal to third row value of column ecr.
I tried with the following query but it doesn't seem to give the correct rows.
Any tips would be very much appreciated.
use dbTest
select val, ecr
from tableTest
group by val
having COUNT (val) > 1
I am using SQL Server 2008.
