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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:44:51+00:00 2026-06-05T02:44:51+00:00

Setup I have two List<T> ‘s. The data is un-normalized and from different sources

  • 0

Setup

  1. I have two List<T>‘s.
  2. The data is un-normalized and from different sources which explains the convolution in the desired logic
  3. An informal compound key in the data is fieldA, fieldB, fieldC.
  4. The “fields” are strings – reference types – so their values could be null. I want to drop records where they may be matching on null. I get that null references in C# will match, but in SQL they do not. Adding a !string.IsNullOrEmpty() is easy enough.
  5. This is not a question about DB design or relational algebra.
  6. I have other logic which covers other criteria. Do not suggest reducing the logic shown such that it might broaden the result set. See # 5 above.

The Problem

I want to find the records in listA that are not in listB based on the informal key. I then want to further refine the listA results based on a partial key match.

The SQL version of the problem:

select 
    listA.fieldA, listA.fieldB, matching.fieldC  
 from listA
 left join listB keyList on 
      listA.fieldA = keyList.fieldA and
      listA.fieldB = keyList.fieldB and
      listA.fieldC = keyList.fieldC
 inner join listB matching on
      listA.fieldA = matching.fieldA and
      listA.fieldB = matching.fieldB 
 where
    keyList.fieldA is null  
  • 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-05T02:44:53+00:00Added an answer on June 5, 2026 at 2:44 am

    SQL to LINQ ( Case 7 – Filter data by using IN and NOT IN clause)

    Note: IN and NOT IN use the same function in the LINQ query, but it just use a ! (not) symbol for it. Here is the graphical representation:

    enter image description here

    You use, where <list>.Contains( <item> )

    var myProducts = from p in db.Products
                     where productList.Contains(p.ProductID)
                     select p;
    

    Or you can have a list predefined as such:

    var ids = {1, 2, 3};
    
    var query = from item in context.items
                where ids.Contains( item.id )
                select item;
    

    For the ‘NOT’ case, just add the ‘!’ operator before the ‘Contains’ statement.

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

Sidebar

Related Questions

I have two event recievers setup on a list in 2010. The first is
I have an Inno Setup installer with a Tasks list which has gotten quite
I have two tables of data categories and category relations. This is a setup
I have two WCF services Exchange1.svc and Exchange2.svc both setup to be RESTful JSON
So I have two variables, animationFlag and ajaxFlag. I also have a function setup
I have a Project Collection setup in my TFS2010RC deployment. I have two Projects
Here is my setup. I have two schemas: my_app and static_data . The latter
I have setup an android test project that runs junit tests. It's using two
I have two tables set up in phpmyadmin- table userid and table data. The
I have set up a Core Data model where I have two objects, say

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.