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 8779501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:48:11+00:00 2026-06-13T19:48:11+00:00

I’m trying to convert this linq query to lambda var query = (from a

  • 0

I’m trying to convert this linq query to lambda

 var query = (from a in context.Table_A
                         join u in context.Table_B  on a.scored equals u.userid
                         join u2 in context.Table_B on a.scorer equals u2.userid
                         from cs in a.Table_C //(Table_A is related to Table_C)
                         where (a.date>= startdate && a.date < enddate)
                         select new MSViewModel
                         {
                             scored= u.User.name,
                             scorer= u2.User.name,
                             subject_name = cs.Subject.name,
                             score = cs.score,
                             categoryid = cs.id,
                         })
                            .AsEnumerable()
                            .GroupBy(t => t.scored)
                            .ToList();

so far this is what i have. I’m kinda lost what to do next.

 var tobi = db.Table_A.Join(db.Table_B,a=>a.scored,u=>u.userid,
                    (a,u) => new {scored=u.User.name });
                    db.Table_A.Join(db.Table_B,a1=>a1.scorer,u2=>u2.userid, 
                    (a,u2)=> new {scorer= u2.User.name});
  • 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-13T19:48:13+00:00Added an answer on June 13, 2026 at 7:48 pm

    Firstly, I’d agree with Arran’s comment: the query expression is going to be much simpler to deal with. I’m absolutely on board with using the lambda form where it makes sense, but joins are generally much simpler in query expressions.

    Having said that, you basically need to imitate transparent identifiers. The code below is untested, but looks vaguely plausible to me.

    var query = context.Table_A
                       .Join(context.Table_B, a => a.scored, u => u.userid,
                             (a, u) => new { a, u })
                       .Join(context.Table_B, p => p.a.scorer, u2 => u2.userid,
                             (p, u2) => new { p, u2 })
                       .SelectMany(q => q.p.a.TableC, (q, cs) => new { q, cs })
                       .Where(r => r.q.p.a.date >= startdate && r.q.p.a.date < enddate)
                       .Select(q => new MSViewModel {
                                      scored= r.q.p.u.User.name,
                                      scorer= r.q.u2.User.name,
                                      subject_name = r.cs.Subject.name,
                                      score = r.cs.score,
                                      categoryid = r.cs.id,
                                    })
                       .AsEnumerable()
                       .GroupBy(t => t.scored)
                       .ToList();
    

    Basically p and q and r are the transparent identifiers here. You’ve got three of them because you’ve got two joins and a subsequent from clause.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Does anyone know how can I replace this 2 symbol below from the string
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.