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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:01:02+00:00 2026-06-06T16:01:02+00:00

I found a weird way of how mysql does something. Someone please explain why

  • 0

I found a weird way of how mysql does something. Someone please explain why it happens.

I select all the columns from table A, and left join from table B with a certain condition, that may or may not be met for each table A row.

Now after the joins, in the WHERE statement, I want to completely leave out rows (not the join part, but whole rows) that have a table B’s column categoryId of value 14 IF the there are table B results (if there aren’t, I do want the row to be kept).

So in WHERE I do WHERE tableB.categoryId != 14. There are no results (when there are supposed to be). For curiosity, I tried to rewrite the operator to =, so WHERE tableB.categoryId = 14, and the result was that the results I wanted I didn’t get, a and the results I didn’t want I did get.

I don’t understand this, this is weird.
Shouldn’t the not equals thing have worked?
I also tried !(tableB.categoryId = 14), but that also yielded no results. At the end, I tried WHERE IF(tableB.categoryId = 14, 0, 1), and that did work for some reason. Why did that work and why didn’t the not equals and negating operators work?

  • 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-06T16:01:03+00:00Added an answer on June 6, 2026 at 4:01 pm

    You need WHERE tableB.categoryId IS NULL OR tableB.categoryId != 14

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

Sidebar

Related Questions

I have just found something very weird while developing a website. While trying to
I've found it very weird that simple code like this is not valid: select
looking for a way to read arguments from a configuration file I found a
I found something weird. Let's say I have a Car model and a Company
I've found a weird effect when trying to track down a memory leak in
I believe I have found a weird bug as follow: I want to delete
I just started a new Typo3 4.6 site and I found this weird line
I'm running Windows 7 with UAC enabled . I've always found it weird that
I just found out this weird behavior, is this a bug or what am
I found all value passed by Model is not trimmed in ASP.net MVC3 Is

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.