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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:41:34+00:00 2026-06-09T20:41:34+00:00

I am having some trouble with an sql query. The below query returns the

  • 0

I am having some trouble with an sql query. The below query returns the rights result. It returns the members in the table that are male, speak swedish and are in group 4.

SELECT DISTINCT Member.ID 
FROM Member
LEFT OUTER JOIN Experience ON Experience.MemberID = Member.ID
LEFT OUTER JOIN Qualification ON Qualification.MemberID = Member.ID
LEFT OUTER JOIN Language On Language.MemberID = Member.ID
LEFT OUTER JOIN Member_Interests ON Member_Interests.MemberID = Member.ID
LEFT OUTER JOIN Group_Members ON Group_Members.MemberID = Member.ID
WHERE 1=1 AND Gender = 'male' AND Language.Name IN ( 'Swedish' ) AND Group_Members.GroupID = 4 

However if I exclude the other where criteria that search directly on the members table then the language.Name is simply ignored. Ie.

SELECT DISTINCT Member.ID 
FROM Member
LEFT OUTER JOIN Experience ON Experience.MemberID = Member.ID
LEFT OUTER JOIN Qualification ON Qualification.MemberID = Member.ID
LEFT OUTER JOIN Language On Language.MemberID = Member.ID
LEFT OUTER JOIN Member_Interests ON Member_Interests.MemberID = Member.ID
LEFT OUTER JOIN Group_Members ON Group_Members.MemberID = Member.ID
WHERE 1=1 AND Language.Name IN ( 'Swedish' ) AND Group_Members.GroupID = 4

The above query returns all members that are in group 4. The Swedish part is simply ignored and as long as there is a langauge in the Langauges table called Swedish then all users are returned. If the language is not in the table then no users are returned.

I would like the second query to just return all members in group 4 that speak swedish. Does anyone know why this is not happening?

  • 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-09T20:41:36+00:00Added an answer on June 9, 2026 at 8:41 pm

    Move the filters on the left joined tables to the joins.

    eg:

    LEFT OUTER JOIN Language On Language.MemberID = Member.ID 
         and LanguageID in ('Swedish')
    LEFT OUTER JOIN Group_Members ON Group_Members.MemberID = Member.ID 
         AND Group_Members.GroupID = 4 
    ...
    WHERE 1=1 AND Gender = 'male' 
    

    etc.

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

Sidebar

Related Questions

I'm having trouble with a query in SQL Server 2008 on some forex trading
I'm having some trouble with an SQL statement that have to find the number
I'm having some trouble with a SQL Server 2005 database that seems like it's
I'm having some trouble executing a nested sql query. It works fine when i
Having some trouble with some SQL. Take the following result for instance: LOC_CODE CHANNEL
I writing a query within ms sql server 2005 and having some trouble getting
I'm having a bit of trouble getting a SQL query to work. Some background
just having some trouble with an SQL update in PHP. Listed below is an
I am having trouble and need some help finding a correct SQL query. Here
I'm having trouble with an SQL query. The problem is that I'm querying an

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.