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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:06:16+00:00 2026-05-23T16:06:16+00:00

I have two tables. Contacts table – contact_id, contact_email, contact_name, etc Opt out table

  • 0

I have two tables.

  1. Contacts table – contact_id, contact_email, contact_name, etc
  2. Opt out table – contact_email, scope of their opt out (event, company)

So one contact maybe have multiple event opt-outs but what I really care about is if they have a company wide opt out.

How do I join the data so that if a contact has a match with any row in the optout table that has a scope of “company” it will not show up in the result?

  • 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-23T16:06:17+00:00Added an answer on May 23, 2026 at 4:06 pm
    SELECT c.*
        FROM Contacts c
        WHERE NOT EXISTS(SELECT NULL
                             FROM OptOut o
                             WHERE c.contact_email = o.contact_email
                                 AND o.scope = 'company')
    

    This could also be done with a LEFT JOIN:

    SELECT c.*
        FROM Contacts c
            LEFT JOIN OptOut o
                ON c.contact_email = o.contact_email
                    AND o.scope = 'company'
        WHERE o.contact_email IS NULL
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables: contacts and contact_temps. The contact_temps table mirrors the contacts table.
I have two Tables: Table-1: notes Table-2: contacts My basic objective is to perform
I have two tables in my database: user and media_contact . The media_contact table
I am using Entity Framework and I have two tables, a contact relationship table
I have two tables: Contact (id,name) Link (id, contact_id, source_id) I have the following
I have two tables: table a ida valuea 1 a 2 b 3 c
I have two tables one with ID and NAME table 1 ID | NAME
I have two tables - 'business' and 'business_contacts'. The business_contact table has a many-to-one
I have two tables RSLTS and CONTACTS: RSLTS QRY_ID | RES_ID | SCORE -----------------------------
I have two tables points and contacts and I'm trying to get the average

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.