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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:12:16+00:00 2026-05-10T20:12:16+00:00

DDL for Database Tables: Users: id – int – identity name – varchar –

  • 0

DDL for Database Tables:

    Users:     id - int - identity     name - varchar - unique      PCs:     id - int - idnetity     name - varchar - unique     userid - FK to Users      Apps:     id - int - identity     name - varchar     pcid - FK to PCs 

I created a DataContext using the Linq To SQL designer in Visual Studio 2008.

I want to perform this query:

select   users.name,   pcs.name,   apps.name from   users u   join pcs p on p.userid = u.id   join apps a on a.pcid = p.id 

I was told in another thread where I posted an answer that the following was incorrect and that it created a cross-join.

var query = from u in db.Users // gets all users         from p in u.PCs // gets all pcs for user         from a in p.Apps // gets all apps for pc         select new         {             username = u.Name,             pcname = p.Name,             appname = a.Name         }; 

When I execute this query I get the correct results. A cross-join with two records in each table should return 8 records but my query correctly returns the two records.

Am I lucky, or is the person telling me that I’m wrong confused?

  • 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. 2026-05-10T20:12:17+00:00Added an answer on May 10, 2026 at 8:12 pm

    That will work. It’s normal because the second ‘from’ inquires in the PC’s set of the users and the third ‘from’, the Apps set of the pcs. And I guess that is not going generate a cross join as T-Sql, because the conditions are already defined in the foreign keys and associations.

    But I guess this should be the syntactically you want by inner join;

    var query = from u in db.Users             join p in db.PCs on p.UserId == u.Id             join a in db.Apps on a.PCId == p.Id             select new             {                 username = u.Name,                 pcname = p.Name,                 appname = a.Name             }; 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 114k
  • Answers 114k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I think the original poster is asking how to detect… May 11, 2026 at 10:19 pm
  • Editorial Team
    Editorial Team added an answer Using ADO.NET Entities, you need to specify what entities you… May 11, 2026 at 10:19 pm
  • Editorial Team
    Editorial Team added an answer I think you will need to check the directory and… May 11, 2026 at 10:19 pm

Related Questions

DDL for Database Tables: Users: id - int - identity name - varchar -
I would like to confirm that the following analysis is correct: I am building
Intermittently in our app, we encounter LockTimeoutExceptions being throw from SQL CE. We've recently
I'm having a slight terminology meltdown as I design some classes. In Sql Server
I have a set of XSDs from which I generate data access classes, stored

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.