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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:39:25+00:00 2026-06-05T05:39:25+00:00

One of those annoying problems that come along occasionally when you work alone and

  • 0

One of those annoying problems that come along occasionally when you work alone and you get lost in your own head! I’m fully expecting the answer to be simple one:

I have a query like so:

SELECT * FROM table_a
LEFT JOIN table_b ON table_a.order_id = table_b.order_id
WHERE (table_a.column_a='string' OR table_b.column_b='string' OR table_b.column_c='string')
group by column_d

The query is returning all rows and seems to be disregarding the WHERE part of the query…except it isn’t. If I remove the OR parts it works as expected:

SELECT * FROM table_a
LEFT JOIN table_b ON table_a.order_id = table_b.order_id
WHERE (table_a.column_a='string')
group by column_d

Thoughts/obvious problems?

Update

My specific problem was that I was evaluating a string against an integer column, this meant the statement evaluated to unknown. Code is now as above but I only add that specific OR if the string is numeric

  • 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-05T05:39:26+00:00Added an answer on June 5, 2026 at 5:39 am

    By observing your joining i had guess that some of the columns that you are comparing were nullable and where phase returns rows that results to true(NOTE THAT columns which were compared in where phase to null values were resulting to UNKNOWN. Does, not being returned. You can resolve this by adding a condition that would check if values were not Null)

    SELECT * FROM table_a
    LEFT JOIN table_b ON table_a.order_id = table_b.order_id
    WHERE ((table_a.column_a IS NOT NULL AND table_a.column_a='string') OR (table_b.column_b IS NOT NULL AND table_b.column_b='string') OR (table_b.column_c IS NOT NULL AND table_b.column_c='string'))
    GROUP BY column_d
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is one of those things that you read once, say aha! and then
I think this is going to be one of those simple-when-you-see-it problems, but it
I know that detecting scrollbar presence is supposed to be one of those elusive
This is one of those annoying cases where things are working but I don't
Assuming I am correct, how do I convince my client that those annoying intro
This is one of those I probably should know this, but I don't questions.
I just did one of those auto updates of the Android SDK (API 15
This is just one of those little things I did all the time in
I'm working on one of those projects where there are a million better ways
Hey this is going to be one of those dumb questions. I am trying

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.