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

  • SEARCH
  • Home
  • 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 977209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:52:04+00:00 2026-05-16T03:52:04+00:00

I use linq2sql and m_DateContext.Dates class for table ID | ParentID | Datestamp —|———-|———-

  • 0

I use linq2sql and m_DateContext.Dates class for table

ID | ParentID | Datestamp
---|----------|----------
1  | NULL     | 1.8.2010
---|----------|----------
2  | 1        | 2.8.2010
---|----------|----------
3  | 1        | 4.8.2010

etc…

I need to write the linq query to select only rows where ParentID is NULL (ex: ID=1), BUT Value of DATESTAMP must be equals to max date from it’s child rows. (Row ID=3).

Linq query must return an instance of m_DateContext.Dates with non-broken links to entities in database schema.

Result must be smthng like:

ID = 1 ParentID=NULL Datestamp = 4.8.2010

Please help

  • 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-05-16T03:52:04+00:00Added an answer on May 16, 2026 at 3:52 am

    All kinds of assumptions (linq to entities or sql) and I think you want a let…

    var query = (
         from i in TDates
            where i.ParentID==null
         let maxDate= TDates.Max(d=>d.Datestamp) 
         select new {
           NonBrokenRecord = i,
           Datestamp = maxDate
         }
    
    ).ToList();
    

    Once you get the results you could do…

    query.ForEach(x=>x.NonBrokenRecord.DateStamp = x.Datestamp);
    query = query.Select(x=>x.NonBrokenRecord).ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use Linq2Sql to return all rows that contain values from
I notice a lot of the examples for ASP.NET use Linq2Sql as the datasource.
use Text::Table; my $tb = Text::Table->new(Planet,Radius\nkm,Density\ng/cm^3); $tb->load( [ Mercury,2360,3.7], [ Mercury,2360,3.7], [ Mercury,2360,3.7], );
Is it possible to use LINQ2SQL as MVC model and bind? - Since L2S
When we use LINQ2SQL queries, the result of the T-SQL it creates is very
In a bigger project we decided to use Linq2Sql in the web-services (WCF). We
I am slowly porting over an app from MySQL to use Linq2Sql - but
I am using Linq2Sql in VS 2010 (C# .Net 4.0) to handle my database
I often take the classes that linq2sql generates and create a simple data-only class
I'm working on a WP7 mango App that makes use of Linq2SQL for data

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.