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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:21:16+00:00 2026-06-01T23:21:16+00:00

I have one table with name CateringPurchaseOrder. That table contains one column with name

  • 0

I have one table with name CateringPurchaseOrder. That table contains one column with name “PONO”. that column contains same vlaue more than once. I want to retrieve record based on the unique value in “pono” column.

Example:

pono  column1
1        value1 
1        value2  
2        value3  
2        value4  

output:

pono    coulm1 
1           value1  
2           value3  

I have tried with the following code:

IEnumerable<CateringPurchaseOrder> order =   entites.CateringPurchaseOrders.Distinct<CateringPurchaseOrder>(new CateringPorderComparer());

public class CateringPorderComparer : IEqualityComparer<CateringPurchaseOrder>
{
    bool IEqualityComparer<CateringPurchaseOrder>.Equals(CateringPurchaseOrder p1, CateringPurchaseOrder p2)
    {
        return p1.P_O_No == p2.P_O_No;
    }

    int IEqualityComparer<CateringPurchaseOrder>.GetHashCode(CateringPurchaseOrder obj)
    {
        return obj.P_O_No.GetHashCode();
    }
}

I got the following error:

LINQ to Entities does not recognize the method 'System.Linq.IQueryable`1[MilitarymessModel.CateringPurchaseOrder] Distinct[CateringPurchaseOrder](System.Linq.IQueryable`1[MilitarymessModel.CateringPurchaseOrder], System.Collections.Generic.IEqualityComparer`1[MilitarymessModel.CateringPurchaseOrder])' method, and this method cannot be translated into a store expression.

Do you have solution for this problem?

  • 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-01T23:21:18+00:00Added an answer on June 1, 2026 at 11:21 pm

    Linq to entities isn’t able to parse your CateringPorderComparer into SQL.

    If it is not a problem you could do the Distinct operation in your C# code, rather than having the database do it. Depending on how many rows and how many dupoicates there are, this may not be a problem for you.

    To do the Distinct after the database query, convert it to a Eumerable before you do the distinct:

    entites.CateringPurchaseOrders.AsEnumerable().Distinct<CateringPurchaseOrder>(
    new CateringPorderComparer());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have models in project that use more than one table to select. How
I have one main table MainTable ( ID, Name ) The Name column contains
i have one table where one column name is city. for every user i
i have one table, which contains that fields mid , email 1 , 'user_a@...'
I have one table named Staff in access and also have this table(same name)
I have one table called Mydata with date,name,address columns this table is having more
I have one table that includes company information (i.e. name, address, business description...) and
I have one table that looks something like this: id parent_id name 1 0
Suppose I have one table table1 and another table table2. Both has same column
i have one table TABLE_SUBJECT And i pass subject name to DBHelper.java. Then i

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.