How to identify different elements in two column

I have two columns - Column1 containing repetitive values for e.g, (1,1,1,2,4,4,4,4,5,5) and column2 contains unique values(1,2,3,4,5). I have to identify the elements which are not present in the column1.

In this I have to get output - 3.

I tried so many times but couldn’t able to find the solution.

can anyone help me in this.

@Pavannaik, Follow this,


column1 Contains (1,1,1,2,4,4,4,4,5,5)
column2 Contains (1,2,3,4,5)


ASSIGN : string arr1 = (From col in dt.AsEnumerable() Select Convert.ToString(col(“column1”))).Distinct().ToArray()

ASSIGN : string arr2 = (From col in dt.AsEnumerable() Select Convert.ToString(col(“column2”))).ToArray()

ASSIGN : string arr3 = arr2.Except(arr1)

Result: Now arr3 will contain 3 alone as in your case

Dominic :slight_smile:

Thanks for the reply.

it worked fine for me