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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:28:05+00:00 2026-06-15T11:28:05+00:00

In my MySQL table, I have some rows with status = NULL and some

  • 0

In my MySQL table, I have some rows with status = NULL and some with status = 0

When selecting them in a query:

SELECT *
FROM `table`
WHERE `status` != 0

This ignores both 0 and NULL values.

How can I ignore ONLY 0 values?

  • 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-15T11:28:06+00:00Added an answer on June 15, 2026 at 11:28 am

    You can use the is null predicate:

    if status is a numeric field:

    SELECT *
    FROM `table`
    WHERE `status` != 0
    OR `status` IS NULL
    

    if status is a text field:

    SELECT *
    FROM `table`
    WHERE `status` != '0'
    OR `status` IS NULL
    

    This works because NULL != 0 evaluates as NULL and NULL OR TRUE evaluates as TRUE. Rows whose inclusion condition evaluates to NULL are rejected.

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

Sidebar

Related Questions

--I have some rows from my table which I would like to export in
Looking for some ideas here... I have a MySQL table that has 100K rows
I have a table which already contains an index in MySQL. I added some
I have around 100thousand rows in a mysql table, where each row has about
We have a (currently InnoDB) table which contains roughly 500,000 rows. This represents a
I have a column called CODE in a MySQL table which can be NULL.
I have a MySQL table that I have imported from a CSV file. In
In my sql code I have declared a table(A) and inserting some rows to
I have a MySQL table with about 2 million rows, and a script that
I have a MySQL table with an auto increment primary key. I deleted some

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.