sql - Finding duplicate values in a table with a twist -


i have data file has many duplicate values. want both original , duplicate values identified , original , duplicate values ordered side side.

my data files headings along data:

enter image description here

i want data this:

enter image description here

i have found duplicate values using following query:

select a.[wallet] kycnew2   [dbo].[kycnew1] group a.[wallet]   having count(*) > 1 

it has shown duplicate values. not have idea how make original , duplicate values , both of associated data side side. 1 me please?

a combination of row_number() , pivot this. you'll need know maximum number of duplicates before hand see everything.

select   account,   [1] path1,   [2] path2 (   select     account,     path,     row_number() on (partition account order path) r       dups   ) x pivot (   min(path)    r in ([1], [2]) ) piv 

example fiddle


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -