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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:56:01+00:00 2026-05-25T16:56:01+00:00

int id =2 ; (from t1 in Table1 join t2 in Table2 on new

  • 0
int id =2 ;
(from t1 in Table1
 join t2 in Table2
 on new { t1.id, id} equals new { t2.id, t2.otherid }
 select t1).ToList();

Currently the above query gives me a compilation error saying

The type on one of the join expressions is incorrect.

As you can see in the above query I want to join on a single integer value as you would in sql. I want to these so that query is faster and I don’t want to do a where at the end because that would mean it will get all the rows and then filter with the where clause. As I have lot of rows in both the tables it would be good if I can filter rows on join clause itself. Thanks for your help !

  • 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-25T16:56:02+00:00Added an answer on May 25, 2026 at 4:56 pm

    You need to use the same anonymous type (with the same property names) in both halves of the join:

    on new { t1.id, otherId = 2 } equals new { t2.id, t2.otherId }
    

    Your text implies that you actually want to join on a single value; if so, you don’t need an anonymous type at all:

    on t1.id equals t2.otherid
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to get UserCarId(int) from this query and assign to int type variable.
How to expand this query: public Dictionary<int, List<TasksInDeal>> FindAllCreatedTasks() { return (from taskInDeal in
I have a LINQ query: var result = from mt in MessageTypes join mtfmt
Two tables: table_a ------- table_a_id: (primary, int) table_b ------- table_a_id: (index, int, from table_a)
This example is taken from w3schools . CREATE TABLE Persons ( P_Id int NOT
I'm trying to delete an int[] from an ArrayList. Due to my code I
In javascript, what is the best way to parse an INT from a string
How can I get the int value from a string such as 423e -
g++ compiler complains about conversions between related types (from int to enum, from void*
How could I add the values of a matrix int[,] diagonally from bottomleft, to

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.