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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:22:10+00:00 2026-05-14T08:22:10+00:00

I have to concat 2 linq2sql query and I have an issue since the

  • 0

I have to concat 2 linq2sql query and I have an issue since the 2 query doesn’t return the same number of columns, what is weird is after a .ToList() on the queries, they can concat without problem.

The reason is, for some linq2sql reason, I have 2 more column named test and test2 which come from 2 left outer join that linq2sql automatically create, something like “select 1 as test, tablefields”

Is there any good reason for that? how to remove this extra “1 as test” field?

here a few of examples of what it look like: google result for linq 2 sql “select 1 as test”

  • 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-14T08:22:10+00:00Added an answer on May 14, 2026 at 8:22 am

    OK, let’s assuming we have 2 tables: dbo.User and dbo.Client. Each client may be connected (or not) to user. So client records have a nullable foreign key field identifying a user.

    For the query:

    var query = context.Clients
          .Select(c => c.User);
    

    LINQ will produce something similar to:

    SELECT [t2].[test], [t2].[Id], [t2].[Username], ...
    FROM [dbo].[Client] AS [t0]
    LEFT OUTER JOIN (
        SELECT 1 AS [test], [t1].[Id], [t1].[Username], ...
        FROM [dbo].[User] AS [t1]
        ) AS [t2] ON [t2].[Id] = [t0].[UserId]
    

    Since not all client records have a matching user record, LINQ is creating a query that ensures there will be a row filled with nulls for every userless client. This is done by creating an extra dummy column called [test].

    So rows which have [test] column value set to 1 are really connected to user entity.

    I suppose this [test] column is used by LINQ as a flag that means “hey, here is a client with user defined”.

    If I decide to rewrite this query, I’ll use user primary key as the indicator, but it seems for LINQ it is easier to use [test] column.

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

Sidebar

Related Questions

I have two long type columns that I want to concat during sql query.
I have an query like: SELECT id as OfferId FROM offers WHERE concat(partycode, connectioncode)
Hi I have written this query SELECT cl_brands.name AS Brand,DATE_FORMAT(cl_doctor_call.date_entered,'%b%y')AS MonthYear, SUM(FIND_IN_SET(CONCAT('^',cl_brands.id,'^'),cl_doctor_call_cstm.brand_discussed_c))AS No_Times_Brand_Discussed FROM
I have this query: SELECT concat('insert into catalog_category_entity_text (value) values(test) where value_id = ',
I have this query SELECT (SELECT keyword FROM url_aliAS WHERE query = CONCAT(category_id ,
Alright, so I have a query that looks like this: SELECT `orders`.*, GROUP_CONCAT( CONCAT(
I have this following query: SELECT a.rank AS rank, concat( m.prenom, ' ', m.nom
I have two JSON objects with the same structure and I want to concat
This is kinda weird. I have the next query: SELECT * , GROUP_CONCAT( x.tag
i have problem in searching concat values, is there any ways using mysql query

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.