Click here to Skip to main content
15,896,456 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
See my previous question at:
How to select distinct data from DataBase with LINQ To SQL and have a good performance ?[^]


Hi all,

I need to remove frequent records from the result:

All result:
name department school
A---- D ---- S
A ---- C---- S
A---- D ---- S
B ---- D---- S



the result should be after using DISTINCT:

name department school
A---- D---- S
B---- D---- S
A---- C---- S
Posted
Updated 7-May-11 1:02am
v4
Comments
Dalek Dave 7-May-11 4:29am    
Edited for Grammar and Readability.
Keith Barrow 7-May-11 4:36am    
Please paste your Code into your question.
yesotaso 7-May-11 4:42am    
Same Question: http://www.codeproject.com/Questions/192615/How-to-select-distinct-data-from-DataBase-with-LIN.aspx
Same inqusitor, same answer, 30 mins time frame...
NuttingCDEF 7-May-11 6:59am    
Agreed - why do people think that if they ask a question and don't like or don't understand the answer that they'll get a different answer by asking the same question again?

Without any code / more information from the questioner, this feels like it's just a guessing game.

 
Share this answer
 
Hi it-discovery,

This is the query you need :

var Query = (from query in dataClass.Student
             select new
             {
                 name = query.name,
                 department = query.department,
                 school = query.school
             }).Distinct();


This Query will select the output you need.

I hope this help,
Thank you,
:)
 
Share this answer
 
thanks Michael Waguih,
but the query still doesn't work :(
any more idea?
 
Share this answer
 
Comments
Michael Waguih 7-May-11 5:21am    
Can you put your complete code for this problem to help you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900