Click here to Skip to main content
13,832,190 members
Rate this:
Please Sign up or sign in to vote.
See more:
I am having trouble grouping a data retrieved from database which has duplication due to a column with data i don't need. i was trying to use distinct or group by to get rid of the redundancies.

var students= db.student.Distinct().Where(c => c.classdate== tomorrow || c.classdate== todayd).ToList();

it will return student's name but also duplicates student record according to course available on that day. I just wanted to get list of students who has class today and tomorrow.

What I have tried:

I have tired
students.GroupBy(x => new { x.Fn  ame, x.classdate});
Updated 16-Apr-18 0:38am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Try this:
var students= db.student
    .Where(c => c.classdate== tomorrow || c.classdate== todayd)

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web05 | 2.8.190114.1 | Last Updated 16 Apr 2018
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100