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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:47:14+00:00 2026-06-08T03:47:14+00:00

I have written some LINQ but it doesn’t return the correct data, it seems

  • 0

I have written some LINQ but it doesn’t return the correct data, it seems to ignore my where clause. Can anybody advise me on what I am doing wrong with the syntax?

IEnumerable<Ranking> lst = (from r in results
    join m in membersToRank on r.UserId equals m.userId
    join t in teamsToRank on m.teamId equals t.teamId
    where r.ResultDate >= rankingStart
        && r.ResultDate <= rankingEnd 
    select new Ranking
    {
        memberId = m.memberId,
        chain = t.chain,
        name = m.name,
        teamId = m.teamId,
        value = results.Count(i => i.IsCorrect && i.UserId == m.userId)
    }).ToList();
  • 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-08T03:47:16+00:00Added an answer on June 8, 2026 at 3:47 am

    This line

    value = results.Count(i => i.IsCorrect && i.UserId == m.userId)
    

    will bypass the where clause. You have have to repeat the where there

    value = results.Where(...).Count(i => i.IsCorrect && i.UserId == m.userId)
    

    or

    var results2 = results.Where(...)
    

    and then use only results2.

    (as a sidenote, it will even bypass the join, so it could become a little more complex depending on what you want)

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

Sidebar

Related Questions

I have written some relatively simple jQuery plug-ins, but I am contemplating writing something
I have written some code for displaying a drop down list, but the code
I have been using LINQ to query my POCO objects for some time, but
I have written a LINQ to XML query that does what I want, but
I have written some LINQ where I check against a database whether or not
I have written some code that works great, but I don't understand why it
I have written some LINQ to simulate an SQL GroupBy statement (see below). However,
I have written some Python scripts in Eclipse where at some point I have
I have written some code that loads an XML document using an XmlDocument object
I have written some extension modules for eJabberd most of which pass pieces of

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.