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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:41:07+00:00 2026-06-03T21:41:07+00:00

Going nuts over this. Simple query but its just not working. I simply need

  • 0

Going nuts over this.

Simple query but its just not working.
I simply need to get the company units that are not currently assigned to any users.

IDs are GUID type.

When debugging I see that there are 2 objects in companyUnits and 1 in userCompanyUnits.
I’m trying to get that 1 companyUnit ( that doesn’t exist in userCompanyunit) to show.
Instead I get no results back.

Any idea what’s wrong with the query? Maybe i can’t compare based on guids ?

var companyUnitsList = from x in companyUnits
                       where !(from c in userCompanyUnits
                               select c.CompanyUnit.Id).Contains(x.Id)
                        select x;

Thanks in advance !

  • 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-03T21:41:08+00:00Added an answer on June 3, 2026 at 9:41 pm

    Here’s a way of doing it without using the Except operator, and needing a custom IEqualityComparer:

            List<Tuple<int, string>> allUnits = new List<Tuple<int, string>>();
            allUnits.Add(new Tuple<int, string>(1, "unit1"));
            allUnits.Add(new Tuple<int, string>(2, "unit2"));
            allUnits.Add(new Tuple<int, string>(3, "unit3"));
    
            List<Tuple<int, string>> assignedUnits = new List<Tuple<int, string>>();
            assignedUnits.Add(new Tuple<int, string>(2, "unit2"));
    
            var unassigned = allUnits.Where(m => !assignedUnits.Any(asgn => asgn.Item1 == m.Item1));
    
    //Yields unit1 and unit3
    
    • Item1 corresponds to Unit.ID
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm going nuts over this. I can write to a cookie, and then read
Our designer is going nuts about this and I just cannot find the right
You may refer to this post of mine SQL going nuts! does not accept
I'm going nuts over this special quicksort algorithm and I don't know where is
I'm close to going nuts about this now and figured it'd be simple, however,
Either i'm going nuts or nobody likes/liked this feature, but a long time ago
Sometimes I'm going nuts over different query execution plans in development, integration tests, and
I am going nuts trying to figure out this all day but without success.
I'm going nuts here, trying to get my system configured. I have a laptop
please help! I'm really going nuts with this problem! I have a CGI perl

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.