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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:35:55+00:00 2026-05-28T04:35:55+00:00

I have a 2 tables – rout and loc . Table Rout Columns: Id

  • 0

I have a 2 tables – rout and loc.

Table Rout Columns:

Id (PK)
file_key
rout_no
....

This table has 800k records

Table Loc Columns

catalog_no(PK)
country_id    
...

This table has 700k records. So I want something like this (Intersection of between two tables)

SELECT rout.file_key,rout.rout_no,loc.country_id  
FROM ROUT_TBL rout, LOC_TBL loc 
WHERE rout.file_key != loc.catalog_no 

Can you tell me how?

  • 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-28T04:35:56+00:00Added an answer on May 28, 2026 at 4:35 am

    I’m not sure that I understand what you’re asking. “Intersection” is a mathematical term that indicates that you want to determine which values exist in both tables. But the query you posted appears to be looking for the exact opposite– the set of rows in one table that don’t exist in the other.

    If you really mean intersection

    SELECT rout.file_key,
           rout.rout_no,
           loc.country_id
      FROM rout_tbl rout 
           JOIN loc_tbl loc ON (rout.file_key = loc.catalog_no)
    

    If you want all the rows in ROUT that don’t exist in LOC

    SELECT rout.file_key,
           rout.rout_no
      FROM rout_tbl rout
     WHERE NOT EXISTS( SELECT 1
                         FROM loc_tbl loc
                        WHERE loc.catalog_no = rout.file_key )
    

    If you want the data from ROUT along with the data from LOC if it exists

    SELECT rout.file_key,
           rout.rout_no,
           loc.country_id
      FROM rout_tbl rout 
           LEFT OUTER JOIN loc_tbl loc ON (rout.file_key = loc.catalog_no)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi i have tables like this : table entry : id | total_comments _____________________
I have tables item and store (it's a store management system). item table has
I have tables & data like this: venues table contains : id +----+---------+ |
I have tables in a MySQL database like this... CREATE TABLE `someUserTable` ( userId
I have tables like this: tblUsers int UserID string UserName tblUsersInRoles int UserID int
I have tables linked by FK, I query on the first table using entity
In my database I have tables that define types for example Table: Publication Types
hi i have tables like this: Persons: person_id, name then i have many langauge
I have tables: Teachers and Students. We have a SpecialProjects Table where Teachers and
We have tables with more then 3m records. When using innerjoin it is much

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.