2
Answers

how to filter duplicate records in multiple columns asp.net

User107

User107

8y
188
1

In my web application, i need to filter duplicate records in multiple columns.

I tried code:

select distinct col1,col2,col3 from collection
            
select col1,col2,col3 from collection Group By col1,col2,col3

I need to remove duplicate rows in col1,col2 and col3.
I tried with Group By keyword also but it displayed all duplicates also.

can anyone please tell how to do this.

Thank you

 
Answers (2)
0
Midhun T P
NA 19.7k 281.2k 8y
Hi,
I don't think it is possible to achieve what you are looking with a single select query.
You won't get distinct from every columns while selecting multiple columns. Because distinct keyword considers whether a single row is distinct or not. Not a column. Please have a look at below link -
http://dba.stackexchange.com/questions/102677/select-distinct-on-multiple-columns
0
Abhishek Chadha
NA 454 26.3k 8y
your logic is true
could you post the screenshots of the table with data