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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:16:09+00:00 2026-06-05T16:16:09+00:00

Following on from my previous question: Simple inner join in linq How would I

  • 0

Following on from my previous question: Simple inner join in linq

How would I write some linq to do exactly the same as the below..

SELECT A.name, B.name
FROM A
INNER JOIN B ON A.id = B.AID 
INNER JOIN C ON B.id = C.BID
GROUP BY A.Name, B.Name
ORDER BY A.Name

I’ve tried this but it generates nested selects and thus produces a different number of rows.

var r = from a in db.A
join b in db.B on a.Id equals b.AId
join c in db.C on b.Id equals c.BId
group c by c.B into g1
group b by g1.Key.A into g2
select g2.Key;

I need a group of A‘s that contains a list of B‘s which contains a list of C‘s

  • 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-05T16:16:11+00:00Added an answer on June 5, 2026 at 4:16 pm

    Bah my comment lost its formatting

    you can use a let binding in a linq statement to hold a value.

    from a in db.a
    let g1 = a.GroupBy(x => x.Id)
    from item in g1
    let g2 = item.GroupdBy(x => x.Id)
    from item2 in g2
    select new {A = a, B = item, C = item2}
    

    or something like that, hopefully it gives you enough to work it out

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

Sidebar

Related Questions

Okay, this is following on from my previous question reguarding performing a simple ajax
Following on from a previous question, for some reason when I use the following
Following up from my previous question , why is CShell so different from C?
Following on from a previous question relating to heap usage restrictions , I'm looking
Following on from a previous question , I am creating a symbolic link on
This problem follows on from a previous question . When I run the following
Following on from my previous question, I am getting another compilation error on my
Following on from my previous question [link text][1] , I have a new problem.
Following on from a previous question, ( previous question here ), the problem I'm
Following the advice from my previous question , I placed my background process in

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.