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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:27:34+00:00 2026-05-16T03:27:34+00:00

I am having below tables. create table test(int id,int data1); create table test1(int id,int

  • 0

I am having below tables.

create table test(int id,int data1);
create table test1(int id,int data2);

insert into test values(1,1,);
insert into test1 values(2,2);
insert into test1 values(3,3);

insert into test1 values(1,1);

Now I want the rows of test, that don’t participate in join. i.e I want rows (2,2) and (3,3). I want to be able to do this in mysql.

I don’t want to use inner query because of performance.

Thank you

  • 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-16T03:27:35+00:00Added an answer on May 16, 2026 at 3:27 am

    Using LEFT JOIN/IS NULL:

       SELECT t1.*
         FROM TEST1 t1
    LEFT JOIN TEST t ON t.id = t1.id
                    AND t.data1 = t1.data2
        WHERE t.id IS NULL
    

    Assuming the columns being joined on, this is the fastest/most efficient method on MySQL. Otherwise, NOT IN/NOT EXISTS are better choices.

    Using NOT EXISTS:

    SELECT t1.*
      FROM TEST1 t1
     WHERE NOT EXISTS(SELECT NULL
                        FROM TEST t
                       WHERE t.id = t1.id
                         AND t.data1 = t1.data2)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

newb question there. Having MySQL database/tables structure below: CREATE DATABASE `dbTest` CREATE TABLE IF
I have a table with below structure. I am not having control over changing
I have a table structure having a EMP_DATE column as below ID EMP_DATE ----
Given the following html table and script shown below I am having a problem
I having below code for different artifacts, Entity public class ChooseFirst { public int
Suppose I have an XSD file having below lines of code; <xsd:simpleType name=test> <xsd:restriction
I have to related tables like in the example script below: -- Creating table
I'm having issues where I can easily create a table in Jade if I
I've been thinking/searching for an equivalent of the problem that I am having below,
I am having the below statement from stored procedure. It's giving Insufficient Privileges. But

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.