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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:17:55+00:00 2026-06-13T10:17:55+00:00

I have three tables (admin,domain,user) as shown below ‘admin'(admin_id, email, domain_id, pass) ‘domain'(domain_id, name)

  • 0

I have three tables (admin,domain,user) as shown below

  • ‘admin'(admin_id, email, domain_id, pass)
  • ‘domain'(domain_id, name)
  • ‘user’ (user_id, email, domain_id, pass)

Admin table:

+--------------------------------+         
| admin_id | email | domain_id  |          
+--------------------------------+         
| 1        | aaa   | 2034       |        
| 2        | bbb   | 3034       |
| 3        | ccc   | 2034       | 
+--------------------------------+

User table

+--------------------------------+         
| user_id | email | domain_id  |          
+--------------------------------+         
| 11        | aaa   | 2034       |        
| 12        | bbb   | 3034       |
| 13        | ccc   | 2034       | 
| 15        | ddd   | 2034       | 
| 16        | eee   | 3034       |
+--------------------------------+

Domain table:

+-----------------------+         
| domain_id | name    |          
+-----------------------+         
| 2034      | aaa.com |        
| 3034      | bbb.com |
+-----------------------+

Output:

+------------+
|ddd@aaa.com |
|eee@bbb.com |
+------------+

So i want records from user table which are not present in admin table.

Is there any way to this without NOT IN query?

  • 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-13T10:17:56+00:00Added an answer on June 13, 2026 at 10:17 am

    Is there any way to this without NOT IN query?

    Yes, using LEFT JOIN of user with admin.

    If id attribute in user and admin tables is used to decide if the two records belong to the same user, then your LEFT JOIN would be on this attribute, as follows:

    SELECT CONCAT(u.email, CONCAT('@', d.name))
    FROM 
        user u
        JOIN domain d
        ON u.domain_id = d.domain_id
        LEFT JOIN admin a
        ON u.id = a.id
    WHERE 
        a.id IS NULL
    

    If id attribute alone is not enough and you need domain_id as well to decide that two records belong to the same user, then

    SELECT CONCAT(u.email, CONCAT('@', d.name))
    FROM 
        user u
        JOIN domain d
        ON u.domain_id = d.domain_id
        LEFT JOIN admin a
        ON u.id = a.id AND u.domain_id = a.domain_id
    WHERE 
        a.id IS NULL
    

    Edit:

    As per your update to the question, since email and domain are shared by both admin and user tables, you should LEFT JOIN these tables on those two columns:

    SELECT CONCAT(u.email, CONCAT('@', d.name))
    FROM 
        user u
        JOIN domain d
        ON u.domain_id = d.domain_id
        LEFT JOIN admin a
        ON u.email = a.email AND u.domain_id = a.domain_id
    WHERE 
        a.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 three tables as shown in below image. Note: Lead column of projectheader
I have three tables: Users, Groups and GroupsUsers User table: id: 1 username: admin
I have two tables (customers, admin) A user logs in by email and password,
This should be straightforward. I have three tables (relevant columns shown). users : ID,USERNAME,PWD
I have to admin there is slight difference between the columns from both tables.
I have three tables. I have to retrieve the data using Linq statement. My
I have three tables (individuals, groups & recordlabels) and want use the information between
I have three tables of data: table: cars [10,000 rows] table: planes [2,000 rows]
I have three tables: Employee(EmployeeID,Fname,Lname...) ProjectHeader(ProjectID,LeadID,Status....) ProjectDetails(ProjectDetailsID,ProjectID....) Here's my current code: $get_projects = SELECT
I have three tables in a Mysql database - countries, cities and hotels. Their

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.