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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:06:25+00:00 2026-06-05T19:06:25+00:00

I have two tables. One user table and one table in which results are

  • 0

I have two tables. One user table and one table in which results are placed of a certain test.

When a user takes a test his result and his user_id are placed in the results table. When a user never took a test then obviously his user_id won’t be in the results table.

I need to get all the users that are NOT in the results table. Is there a way to do this in one query? (Entity Framework)

Getting all the users is easy. But now i need a way to link it to the results table to see which of the users i want in my result set.

(from u in entity.Users
[where not in results table..??]
select u); 
  • 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-05T19:06:27+00:00Added an answer on June 5, 2026 at 7:06 pm

    Fully working example, using mock objects:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
    
                var usersTakenTest = new List<string>() { "Bob", "Jim", "Angel" };
                var allUsers = new List<string> { "Bob", "Jim", "Angel", "Mike", "JimBobHouse" };
    
                var users = from user in allUsers
                            join userTakenTest in usersTakenTest on user equals userTakenTest into tempUsers
                            from newUsers in tempUsers.DefaultIfEmpty()
                            where string.IsNullOrEmpty(newUsers)
                            select user;
    
                foreach (var user in users)
                {
                    Console.WriteLine("This user has not taken their test: " + user);
                }
                Console.ReadLine();
            }
        }
    }
    

    .DefaultIfEmpty() is what you are after – if it brings back an empty result you have an object in table A that does not show in table B.

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

Sidebar

Related Questions

i have two tables one for users which keeps the user info another is
I have two tables, in which one user can have several contacts: User(UserId, UserName)
I have two tables User id name Result id user_id score created_at Every hour
In SQL Server 2008 I have two tables. One table for users: id_user -
I have two tables, users and hra. A user can only have one record
I have two tables : one table it matchs and the other is teams.
I have three tables: User, Employee and Worker. User table has one-to-zero-or-one relationship with
I have two tables user (one) and transaction (many) and I need to get
I have two tables which i would like to turn into one in a
Using PHP / MySQL I have two tables one is customers the other is

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.