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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:52:07+00:00 2026-06-10T11:52:07+00:00

I have two fields, email and addlEmail . I need a select that only

  • 0

I have two fields, email and addlEmail. I need a select that only selects the record if a given email address is not in either field.

Attempt at using NOT IN with two columns (returns: Cardinality violation: 1241 Operand should contain 2 column(s):)

SELECT WebUsername, 
  WebPassword, 
  Active, 
  Email, 
  AddlEmail, 
  ShowYear 
FROM Exhibitors e 
WHERE e.Active = '-1' 
AND e.ShowYear = 2013 
AND (e.Email, e.AddlEmail) NOT IN ('test@test.com', 'test2@test.com')"

I have tried AND and OR, they do not work for obvious reasons.

For the sake of trying to be thorough:

$emails = "'email@email.com', 'email2@email.com'";
// example table data for 2 fields in question
Row | Email              |   AddlEmail
1   | email@email.com    |   email3@email.com
2   | email4@email.com   |   email2@email.com
3   | email5@email.com   |   null
4   | email6@email.com   |   email7@email.com

The query should only return rows 3 and 4.

Thanks for taking a look, and please let me know if you need further clarification.

Chris

EDIT:
Sample table in response to answer posted:

CREATE TABLE `doubleSelect` (
  `Email` varchar(255) DEFAULT NULL,
  `AddlEmail` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

INSERT INTO `doubleSelect` (`Email`, `AddlEmail`) VALUES
  ('email@email.com', 'email2@email.com'),
  ('email2@email.com', 'email3@email.com'),
  ('email4@email.com', 'email5@email.com'),
  ('email6@email.com', 'email@email.com'),
  (NULL, 'email@email.com'),
  ('email2@email.com', NULL);

Sample Query (does not return the last row, and it should):

SELECT *
  FROM `doubleSelect`
  WHERE Email NOT
  IN (
    'email@email.com'
  )
  AND AddlEmail NOT
  IN (
    'email@email.com'
  )
  • 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-10T11:52:09+00:00Added an answer on June 10, 2026 at 11:52 am

    Try this

    select * 
    from Exhibitors 
    where (email is null or email not in('email@email.com', 'email2@email.com'))  
    and   (addlEmail is null or addlEmail not in ('email@email.com', 'email2@email.com'))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two fields that need to multiply each other and fill a third
I have two email fields on a form to validate that the user entered
I have two fields on the form ( forgotpassword form ) username and email
Say I have two fields in a new or edit form: <%= f.text_field :email
I have two fields that I'd like to match. (already done the validation functions
We have two mailing lists that we need to combine, and then make sure
I have a table that contains, for example, two fields that I want to
I have two mysql table Table 1 id email other fields Table 2 id
for email validation I have these two input fields: <input class=inputbox type=text name=data[subscriber][email] id=field_email
I have two fields in separate linked tables with the same data, but different

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.