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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:43:35+00:00 2026-06-02T05:43:35+00:00

How can i write an sql query to only return rows from a table

  • 0

How can i write an sql query to only return rows from a table

where for example column A is not null AND columb B is not 0

the way i am writing it is:

where A is not null AND B !=0 

but the problem is that the query result is also eliminating rows where only one of the conditions is true such as column a being null but column b being anything but 0 & vice versa

I need the query to only eliminate (not return) the rows where BOTH conditions of my where clause are met.

I only want the result i get from query to be rows from the table where column A is not NUll and column B IS NOT = 0 but i need BOTH conditions to be met not just one of them

  • 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-02T05:43:36+00:00Added an answer on June 2, 2026 at 5:43 am

    Someone posted this Answer on here but then they deleted it (not sure why?) but their answer worked and it was.

    WHERE NOT(A is null AND B=0)
    

    i tried using

    where A is not null AND B <> 0   
    

    and

    where (A is not null AND B <> 0) 
    

    but the where clause would be triggered even if only 1 of the conditions was met and I needed it to be triggered only when both conditions where met.

    So again, the answer to my questions was using the below code.

    WHERE NOT(A is null AND B=0)
    

    Thanks!

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

Sidebar

Related Questions

I want to write a SQL query to return results from 9PM yesterday until
How can I write a query similar to this one in LINQ to SQL
Can I write the T-SQL like below select * FROM (select * from TableA
How would one write a sql server DDL script that can: For each table
how can i write to a mysql table with ruby ? run SQL. for
I am trying to write a SQL query to fetch rows whose fields contain
I need to write an SQL query to take either from one of two
in SQL Server, if I have an int variable, how can I write a
Please help me to write the following sql. I have a table like this,
How to write sql query for set of key value pairs using AND operation

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.