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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:41:32+00:00 2026-05-25T13:41:32+00:00

1) into keyword creates temporary identifier for storing results of join, group or select

  • 0

1)

into keyword creates temporary identifier for storing results of join,
group or select clauses.

I assume into keyword can only be used as part of group, join or select clauses?

2)

a) I’ve read that when into is used as a part of group or select clauses, it splices the query in two halves and because of that range variables declared in first half of the query ALWAYS go out of scope in the second half of the query. Correct?

b) But when into is used as part of the join clause, rangle variables NEVER go out of the scope within the query ( unless query also contains group...into or select...into ). I assume this is due to into not splicing the query in two halves when used with join clause?

c)
A query expression consists of a from clause followed by optional query body ( from,where,let clauses ) and must end with either select of group clause.

d) If into indeed splices query into two halves, is in the following example group clause part of the body:

        var result = from c1 in a1
                     group c1 by c1.name into GroupResult
                     select ...

thank you

Reply to Ufuk:

a)

After a group by you get a sequence of like this
IEnumerable>

Doesn’t a GroupBy operator return a result of type IEnumerable<IGrouping<Key,Foo>> and not IEnumerable<Key,IEnumerable<Foo>>

b) Couldn’t we arguee that group...by...into or join...into do splice the query in a sense that first half of the query at least conceptually must run before the second half of the query can run?

Reply to Robotsushi:

the more I’m thinking about it, the more I get the feeling that my question is pretty pointless since it has no practical value what so ever. Still…

When you say it gets split. Do you mean the scope of the variables
gets split or the sql query generated gets split

Here is the quote:

In many cases the range variables on one side of this divide cannot be
mixed with the range variables on the other side. The into keyword
that is part of this group-by clause is used to link or splice the
two halves of this query. As such, it marks the boundary in the midst
of the query over which range variables typically cannot climb. The
range variables above the into keyword go out of scope in the last
part of this query.

My question is whether both halves are still considered a single query and as such the entire query still consists of just three parts. If that is the case, then in my code example ( under d) ) group clause is part of the body. But if both halves are considered two queries, then each of the two queries will consist of three parts

2. reply to Robotsushi:

This chunk of your query is evaluated as one data pull.

I’m not familiar with the term “data pull”, so I’m going to guess that what you were trying to say is that first half of the query executes/evaluates as a unit, and then second half of the query takes the results from the first half and uses the results in its execution/evaluation? In other words, conceptually we have two queries?

  • 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-25T13:41:33+00:00Added an answer on May 25, 2026 at 1:41 pm

    group… by …into

    A group by has to provide a different kind of sequence after the operation.

    You have a sequence like this:

    IEnumerable<Foo>
    

    After a group by you get a sequence of like this

    IEnumerable<Key,IEnumerable<Foo>>
    

    Now your items are in nested sequences and you don’t have direct access to them. That’s why identifiers in first part are out of scope. Since your first part is out of scope, you are left with the identifier after the into. It has ended and a new query can begin. Your second part of the query works on a total different sequence from the first one. It’s a continuation.

    from foo in foolist
    group foo by foo.name into grouped
    //foo is out of scope, you are working on a different sequence now
    //and you have a ready to use range variable for your second query
    

    join … on … into

    On the other hand, group join is not that kind of operation.They operate on two sequences where group by operates on one. They will provide matching elements on the right sequence for the left sequence.

    IEnumerable<Left> and IEnumerable<Right>
    

    After the operation it lets you use the identifier from the left sequence, but the identifier in right is out of scope. That’s because join returns a sequence of them now. So again you don’t have direct access to them. The outcome of group join is like:

    IEnumerable<Left,IEnumerable<Right>>
    

    When you use group join, only right range variable goes out of scope. While the left part still remains, you are still working on the same sequence. You haven’t provided a projection yet, so you can’t continue a second query.

    from left in leftList
    join right from rightList
        on left.Key equals right.Key into joinedRights
    // left is still your range variable, you are still enumerating leftList
    // you have to provide a projection here but you won't have a ready to use range variable
    // that's why it's not a continuation.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Really simple problem: I want to split a connection string into its keyword /
I need to split a keyword string and turn it into a comma delimited
I'd like to reproduce the following SQL into C# LinqToSql SELECT TOP(10) Keywords.* FROM
I'm extracting the value of a node into a variable: <xsl:variable name=UPC select=//x:input[@name='field-keywords']/@value/> <xsl:value-of
INSERT INTO options (owner, name, value, modified) SELECT owner, name, value, modified, @draft:=draft FROM
I am trying to select from the join of the two related tables in
I have the user enter a keyword which is broken up and put into
Just reading in a C++ book that you can literally drop assembler into C++
this Question moved to how to prevent an Gated Check-In to put the Keyword
Into a class constructor, I need to create some objects on the fly and

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.