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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:54:27+00:00 2026-05-15T23:54:27+00:00

I am trying to achieve a query which includes a subquery which itself includes

  • 0

I am trying to achieve a query which includes a subquery which itself includes grouping.

I based my code from answers to this question

The purpose of the code is to perform a simple de-duplication of the ‘person’ table based on the email address and return the latest person row.

var innerQuery = (from p in db.Person
                              join r in db.Registration on p equals r.Person
                              join e in db.EventDetail on r.EventDetail equals e
                              where e.Client.ClientID == clientID
                              group p by p.Email into g
                              select g.Max(p => p.PersonID));

var query = (from p2 in db.Person where innerQuery.Contains(p2.PersonID) select p2);

When the query is attempted to execute, I get the following error message:

LINQ to Entities does not recognize
the method ‘Boolean
Contains[Int32](System.Linq.IQueryable`1[System.Int32],
Int32)’ method, and this method cannot
be translated into a store expression.

I have tested the innerquery and it just returns a list of ints as expected, but the query fails with the above message.

Any help greatly appreciated.

  • 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-15T23:54:28+00:00Added an answer on May 15, 2026 at 11:54 pm

    Isn’t query just a join?

    var query = from p2 in db.Person
                join iq in innerQuery on p2.PersonID equals iq
                select p2;
    

    I’m not sure about = iq part but I don’t usually use that syntax sorry – in the other form it would be

    .Join(innerQuery, p2 => p2.PersonId, iq => iq, (p2, iq) => p2);
    

    for the join and the select.

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

Sidebar

Ask A Question

Stats

  • Questions 523k
  • Answers 523k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There is not get_data function!! You'll have to code one… May 16, 2026 at 9:38 pm
  • Editorial Team
    Editorial Team added an answer You need to iterate all the subviews of the current… May 16, 2026 at 9:38 pm
  • Editorial Team
    Editorial Team added an answer Use the streambuf members, that's what they are for: fout… May 16, 2026 at 9:38 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am trying to write a sql query which fetches all the tags related
I have a query that pulls back a user's feed which is essentially all
Been trying this for quite a while now and I need help. Basically I
I'm trying to get my head around a query and I just can't figure
I am trying to make a gridview sortable which uses a stored procedure as
I need a way to dynamically populate this query... to avoid repeating the same
What I am trying to achieve is to get the rows having the maximum
I'll try and explain what I'm trying to achieve quickly, since I have no
I have a sample database like this, in which, id is always unique, but
I'm trying to build a multidimensional associative array while fetching the results from a

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.