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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:19:14+00:00 2026-05-25T11:19:14+00:00

I am working with a third party database and need to select a distinct

  • 0

I am working with a third party database and need to select a distinct set of data for the specific market that I am looking into. The data is the same for each market, so it is redundant to pull it all in, and I don’t want to hardcode any logic around it as we are working with the vendor to fix the issue, but we need a fix that will work with the vendors fix as well as the way the database is currently as it could be some time before thier fix goes live.

I do not want to group by anything as I want to get the data at the lowest level, but I don’t want any redundant data. My current query looks similar to this…

determinantData = (from x in dbContext.Datas
                   where x.Bar.Name.Equals(barName) &&
                         x.Something.Name.Equals(someName) &&
                         FooIds.Contains(x.Foo.Id) &&
                         x.Date >= startDate && 
                         x.Date <= endDate
                   select x).Distinct();

This does not do what I expect. I would like to select the distinct records by three properties, say Foo, Bar, and Something but return the entire object. How can I do this using LINQ?

  • 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-25T11:19:14+00:00Added an answer on May 25, 2026 at 11:19 am

    You could use group by with the properties that you want to be distinct, then select the first item of each group:

    determinantData = (from x in dbContext.Datas
                       where x.Bar.Name.Equals(barName) &&
                             x.Something.Name.Equals(someName) &&
                             FooIds.Contains(x.Foo.Id) &&
                             x.Date >= startDate && 
                             x.Date <= endDate
                       group x by new { x.Foo, x.Bar, x.Something } into market 
                       select market).Select( g=> g.First()); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on third party data which I need to load into my
I'm working with a third party software package that is on it's own database.
I am having problems with working with a third party XML string that contains
While working on a C++ project, I was looking for a third party library
I've been working on an application that will allow for third-party extensions to be
I have a project I'm working on in Qt creator that requires a third-party
I'm working with a third-party library interfacing to an old database system. There's a
I am working with a third party plugin, that has a small bug. This
When working with third party systems, especially very configurable systems that dynamically load providers,
I am working with a third party asp.net application that uses master pages and

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.