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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:49:38+00:00 2026-06-15T23:49:38+00:00

I am trying to fetch out records from left table only those records which

  • 0

I am trying to fetch out records from left table only those records which are not in right table. I have near about 5000 records in the left table. Similarly, the same thing is need to be done on more than 3-4 tables. I have to find out records from first table that are not in rest of my 3-4 tables. The same primary or foreign key concept is working their.

My first attempt taking two tables fetch out 5,70,000 records from original 5k records. Repeating the record.

SELECT m.* FROM members m, pinnumber p where p.pinmemberid != m.memberid 

My second attempt also made my-sql browser hang.

SELECT m.* FROM members m
LEFT JOIN pinnumber p ON p.pinmemberid != m.memberid
LEFT JOIN customer c ON m.memberid != c.memberid

My third attempt is also making a lot of time

SELECT * FROM members m
         WHERE 1=1 AND AND not exists ( select 1 from pinnumber p where 1=1 And
         p.pinmemberid = m.memberid AND p.pinproductid LIKE '%Remit%')
         AND not exists ( select 1 from customer c where 1=1 and c.card_name is not null AND m.memberid = c.memberid )

Please suggest me what to do with this. If I need to put non-equi join on this.

  • 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-15T23:49:39+00:00Added an answer on June 15, 2026 at 11:49 pm

    This query will try to join the first table members with tables pinnumber and customer:

    SELECT m.*
    FROM
      members m
      LEFT JOIN pinnumber p ON p.pinmemberid = m.memberid
      LEFT JOIN customer c ON m.memberid = c.memberid
    WHERE p.pinmemberid is null and c.memberid is null
    

    since we are using a left join, the query will return all rows of members but if the join doesn’t succeed pinmemberid and memberid will be null. The rows in which those values are null are the ones that doesn’t exist in the right tables. You might want to use OR instead of AND.

    If you use a join with != condition, you will get all rows of the first table multiplied for all rows of the second table, except the ones that have the same id.

    Another way to get the same result is this:

    SELECT members.*
    FROM members
    WHERE
      memberid not in (select pinmembedid from pinnumber)
      and memberid not in (select memberid from customer)
    

    (substitute AND with OR if you wish). NOT IN clause might be a little slower, but it’s easier to understand.

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

Sidebar

Related Questions

I am trying to list out all records from a database that have not
I have this weird problem in java when trying to fetch records from MYSql
I am trying to fetch wcf service from jquery. I have written below code
I am trying to fetch records from Oracle 9i database whose value are 'FOO
I am trying to fetch records from 2 tables mapped by an id where
I'm trying to fetch the amount of views out of the youtube api, it
I'm trying to fetch data from a page that resides on an intranet. The
I am trying to fetch a gzip from a URL and import it automatically
I'm trying to fetch some JSON data from my server like so: var a
I'm trying to fetch some settings from my membership provider in my asp.net application

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.