Hi,
I would like to know how to find duplicate records based on exact match on some columns and slight difference on others...
for example, I have a table with the following fields
- Name nvarchar(50)
- City nvarchar(50)
- State nvarchar(50)
- Age int(10)
Now, I wish to search for records that have similar values in the first three columns and differ in the last column (age) by a value less than or equal to 5.
For example
Name City State Age
ABC MUMBAI MAHARASHTRA 51
PQR KOLKATA WEST BENGAL 51
ABC MUMBAI MAHARASHTRA 51
PQR BANGALORE KARNATAKA 51
ABC MUMBAI MAHARASHTRA 49
This should return first, thrid and fifth records as 51-51=0 (which is less than 5) and 51-49=2(which is also less than 5)
Thanks....................