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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:57:30+00:00 2026-06-09T01:57:30+00:00

For example, I have two tables that look like this DATATABLE 1 COLA |

  • 0

For example, I have two tables that look like this

DATATABLE 1

COLA  |  COLB  |  COLC 
 1       123      321
 2       321      333
 3       222      232

DATATABLE 2

COLA  |  COLB  |  COLC 
 1       123      321
 2       321      333

I want to select only row 3 from table one.

I want to be able to join the two tables together on the COLA ID, but then only select the rows from DATATABLE 1 that do noto exist in DATATABLE 2.

How can I do this in LINQ?

I would strongly prefer the results to be a datatable, or Ienumerable or something easy to change back into a datatable. if it’s not possible i will manage.

  • 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-06-09T01:57:31+00:00Added an answer on June 9, 2026 at 1:57 am
    var rows = from t1 in table1.AsEnumerable()
               join t2 in table2.AsEnumerable() 
                   on t1.Field<int>("COLA") equals t2.Field<int>("COLA") into tg
               from tcheck in tg.DefaultIfEmpty()
               where tcheck == null
               select t1
    

    This ultimately performs a left outer join, and any rows from table2 that are null means the record in table1 doesn’t have a match. I would recommend against using the Any method, as it could possibly enumerate table2 for every row in table1 (which for larger sets, this is bad). LINQ Join will enumerate both tables only once in order to find the matching pairs for the selector function you specify.

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

Sidebar

Related Questions

I have a two tables that look like this (this is an example of
I have two tables that look something like this: Checkpoint with field: Checkpoint_id Checkpoint_name
I have two tables in a teradata database that look like this accounts account_number
I have two tables that look like this Train +----------+-------------+------+-----+---------+-------+ | Field | Type
I have two tables like that: Products(productID,categoryID,price) MarginOfProfit(categoryID,rate) Anytime we want to change prices
I have two tables. First table looks like this: Table: Records rid | user
I have a table that contains common entries in two columns. For Example: Column1
I have two tables, for example: Table A Table B ======= ======= Name |
I have two tables, images and image_data and here is an example of my
In my model, I have two tables with a 1:0..1 relationship between them: (Example

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.