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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:43:26+00:00 2026-05-17T16:43:26+00:00

Just as I can check if a column does not equal one of the

  • 0

Just as I can check if a column does not equal one of the strings given in a set.

SELECT * FROM table1 WHERE column1 NOT IN ('string1','string2','string3');

Is there a single function that I can make sure that multiple columns does not equal a single string? Maybe like this.

SELECT * FROM table1 WHERE EACH(column1,column2,column3) <> 'string1';

Such that it gives the same effect as:

SELECT * FROM table1 WHERE column1 <> 'string1' 
                       AND column2 <> 'string1' 
                       AND column3 <> 'string1';

If not, what’s the most concise way to do so?

  • 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-05-17T16:43:26+00:00Added an answer on May 17, 2026 at 4:43 pm

    I believe you can just reverse the columns and constants in your first example:

    SELECT * FROM table1 WHERE 'string1' NOT IN (column1, column2, column3);
    

    This assumes you are using SQL Server.

    UPDATE:

    A few people have pointed out potential null comparison problems (even though your desired query would have the same potential problem). This could be worked around by using COALESCE in the following way:

    SELECT * FROM table1 WHERE 'string1' NOT IN (
         COALESCE(column1,'NA'), 
         COALESCE(column2,'NA'), 
         COALESCE(column3,'NA')
    );
    

    You should replace ‘NA’ with a value that will not match whatever ‘string1’ is. If you do not allow nulls for columns 1,2 and 3 this is not even an issue.

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

Sidebar

Related Questions

Just wondering is there any way I can check whether the url links to
Just wanted to write some recursion but can't check if the child is in
Just wondering , what i can do to check if exist anything after a
I just can't figure out, why this slidetoggle does't work. It just runs once:
I just can't figure it out how to set custom validator messages in Zend_Form
I just can't realize why my read time out is not working. All I
How does one check the validity of an XML file to show where the
How can I check in MYSQL PHP if two columns are unique then not
I just can't get knockout to bind to the right mousebutton click with the
I just can't figure out or find any solution here, so I chose to

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.