Hi, I have an excel sheet with few columns and one particular column has duplicate values including blanks as well, i want to separate out the unique and the duplicate values in two different datatables , right now I am using the below query , but not able to get the desired result ,
unique records : DT.DefaultView.ToTable(True,“Ticket ID”,“Assignee name”,“Policy Number”,“Ticket subject”,“Submitter name”, “Submitter email”,“Requester Type”,“Profit Center”,“Ticket created - Date”,“Tickets”)
duplicate records : (From p inDT.Select() where (From q in DT.Select() where q(“Policy Number”).Equals(p(“Policy Number”)) Select q).toArray.count>1 select p).ToArray.CopyToDatatable()
(From d In DtRead.AsEnumerable
Group d By k=d("Column Name").toString.Trim Into grp=Group
Where grp.Count = 1
From g In grp
Order By DtClone.Rows.IndexOf(g)
Select r=g).CopyToDataTable
Try with this expression to get the Duplicate value
(From d In DtRead.AsEnumerable
Group d By k=d("Column name").toString.Trim Into grp=Group
Where grp.Count > 1
From g In grp
Order By DtClone.Rows.IndexOf(g)
Select r=g).CopyToDataTable
DtDuplicate = (From p in DT.Select() where( From q in DT.Select() where q("Column Name").Equals(p("Column Name")) Select q).ToArray.Count>1 Select p).ToArray.CopyToDataTable()
DtUnique = (From p in DT.Select() where( From q in DT.Select() where q("Column Name").Equals(p("Column Name")) Select q).ToArray.Count=1 Select p).ToArray.CopyToDataTable()