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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:20:12+00:00 2026-05-31T06:20:12+00:00

Using pubs If I want to join using query syntax I would do this.

  • 0

Using pubs

If I want to join using query syntax I would do this.

from a in db.authors
join ta in db.titleauthors on a.au_id equals ta.au_id
join t in db.titles on ta.title_id equals t.title_id
join s in db.sales on t.title_id = s.title_id
select new { a.au_lname, t.title1, s.qty }

Using method syntax

db.authors
    .Join(db.titleauthors,
        a => a.au_id,
        ta => ta.au_id,
        (a, ta) => new {a, ta})
    .Join(db.titles,
        z => z.ta.title_id,
        t => t.title_id,
        (z, t) => new { z.a, z.ta, t })
    .Join(db.sales,
        z => z.t.title_id,
        s => s.title_id,
        (z, s) => new { z.a, z.ta, z.t, s })
    .Select(z => new { z.a.au_lname, z.t.title1, z.s.qty })

I was wondering if there was an elegant way of dealing with this line
(z, X) => new { z.Y1, z.Y2, z.Y3... , X }

maybe something like
(z, X) => z.push(X)

so I don’t have to write everything out.

Does something like that exist or is possible?

  • 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-31T06:20:14+00:00Added an answer on May 31, 2026 at 6:20 am

    No. Basically query expressions exist in order to keep this stuff away from you. There’s no particularly simple way of mimicking transparent identifiers.

    I find that when you hit transparent identifiers, it’s almost always cleaner to use query expression syntax. It’s definitely worth knowing both, as very simple queries are cleaner using method syntax, but the more complicated the query, the more likely it is to be easier to read using query expressions.

    That’s assuming it can all be represented with method expressions, of course. Don’t forget you can break up queries into separate statements without changing the meaning, so if you do need to call methods which don’t have query expression equivalents, I sometimes find it best to separate it out like this:

    var foo = from x in y
              join a in b on x.Z equals a.Z
              select new { a, x };
    
    var bar = foo.Skip(5)
                 .Take(10)
                 .ToList();
    

    I find that cleaner than just using brackets to mush the two syntax forms together.

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

Sidebar

Related Questions

Using php/html, I want to retrieve email addresses (plus other information) from MySQL and
This might seem a pretty simple question; I'm using the Pubs database with the
Using PHP and MySQL, I want to query a table of postings my users
I am using pubs database and basically I show a list of authors on
Using Rails 3.2.0 with haml and sass: I Would like to link an external
Using WPF/PRISM I want to log my messages through ILoggerFacade to my GUI (A
Using mercurial, I've run into an odd problem where a line from one committer
Using emacs on Ubuntu 11.10. I want to connect to a SQL Server database
using file_get_contents , I open an Internet URL and get the contents of this
From http://pubs.opengroup.org/onlinepubs/009604599/functions/pipe.html : The pipe() function shall create a pipe and place two file

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.