Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8193149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:23:10+00:00 2026-06-07T04:23:10+00:00

I have a table that looks like: Key Date … Name … Status …

  • 0

I have a table that looks like:
Key Date … Name … Status …
(ID) May …
(ID) May …
(ID) May …
(ID) June …
(ID) June …
(ID) June …
(ID) Jul …
(ID) Jul …

What I need is to take the entities in bold as that is the overall property for the set.
So it looks like:

(ID) May …
(ID) June …
(ID) Jul …

The Entity Set is retrieved with:

var status = from a in ObjectContext.InspectionReadings
                     where a.InspectionID == new Guid(inspID)
                     && a.DateTaken > before
                     && a.DateTaken <= DateTime.Now
                     orderby a.DateTaken descending, a.Status descending
                     select a;

Now i just need to filter out the ones I don’t want.

How can I do this?

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T04:23:14+00:00Added an answer on June 7, 2026 at 4:23 am

    You can accomplish this with a GroupBy as well as a call to First.

    For example, given your original query, status, you can do:

    var firstStatuses = 
        status.GroupBy(i => i.DateTaken).Select(g => g.First());
    

    Note that LINQ-to-Entities might not be able to properly group the data, based on requirements for the select clause in your underlying database.

    With that, you can always call AsEnumerable to force the query to occur on objects in memory:

    var firstStatuses = 
        status.AsEnumerable().GroupBy(i => i.DateTaken).Select(g => g.First());
    

    One caveat, you should probably order each group depending on which item you want to be returned (if they aren’t already ordered correctly).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table that looks like this: table name: uno str_id | title
I have a table that looks like this: id value AGA 0.211 AGA 0.433
I have a table that looks like this: CREATE TABLE foobar ( id SERIAL
I have a table that looks like this: ID (pk,int) Col1 (nvarchar) Col2 (nvarchar)
I have a table that looks like this Id FirstName 5 Adam 6 Bob
I have a table that looks like this Group Recipe Priority 0 A 400
I have a table that looks like: Client_ID | Order_ID | 10 | 1
I have a table that looks like this: nid vid tid 1 2 3
I have a table that looks like this: <table> <thead> <!-- random table headings
I have a table that looks like the following: <table class=theClass> <tr> <td class=anotherClass><strong>Label1:</strong></td>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.