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:
i want data this:
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
Comments
Post a Comment