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

The Archive Base Latest Questions

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

I am getting strange results from inner joins. Here is the SQL: SELECT cm.PersonID

  • 0

I am getting strange results from inner joins. Here is the SQL:

SELECT  cm.PersonID
FROM dbo.vwCommitteeMembers cm

-- first join
INNER JOIN dbo.vwCommitteeTerms ct 
      ON (ct.CommitteeID = cm.CommitteeID)

-- second join
INNER JOIN dbo.vwCommitteeTermMembers ctm 
      ON (ct.ID = ctm.CommitteeTermID)

WHERE cm.CommitteeID = 124

If I comment out both joins, I get 24 results. If I uncomment out the first join (leaving second commented out), I also get 24 results. If, however, both joins are uncommented, the results are inflating to 576. Since 24^2 = 576, I have some idea what is happening, but I don’t know why. I am using SQL Server Management Studio 2008, on a Windows 7 Pro x64 workstation, for a SQL Server 2008 database. It “feels” like SSMS is trying to optimize my query somehow, but I really want to know what the root cause is so I don’t have this problem in the future (as this is not the first time I’ve encountered it). I even had a colleague take a look since I assumed I was just “too close” to the problem, and they thought it looked okay, too.

Thanks!

  • 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-08T04:14:38+00:00Added an answer on June 8, 2026 at 4:14 am

    Lamak’s second comment was correct. Expected results are produced when the query is modified to:

    SELECT  cm.PersonID
    FROM dbo.vwCommitteeMembers cm
    
    -- first join
    INNER JOIN dbo.vwCommitteeTerms ct 
          ON (ct.CommitteeID = cm.CommitteeID)
    
    -- second join
    INNER JOIN dbo.vwCommitteeTermMembers ctm 
          ON (ct.ID = ctm.CommitteeTermID AND ctm.MemberID = cm.PersonID)
    
    WHERE cm.CommitteeID = 124
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting strange results from a query using XML EXPLICIT mode in T-SQL
I'm getting some strange results from the log function in gfortran 4.5 (OSX) and
I'm getting strange results testing the return value from a function. This code is
I'm trying to keep my game at 60fps, but I'm getting strange results from
I'm getting strange results from the FusionTable API. Specifically, it seems unable to handle
I'm using DateJS to parse user-inputted dates, and getting some strange results. Date.parse(15 Jan
Hi I'm getting strange feedback from the feedback sandbox server. Actually there should be
Getting a strange error on bundle install.. bundle install Fetching gem metadata from http://rubygems.org/.....
I'm facing very strange issue, I'm getting JSON object from django powered site and
i'm getting a very strange result from my database query, i was hoping someone

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.