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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:30:14+00:00 2026-05-30T05:30:14+00:00

I have two tables. T1 has one column which has 9000 unique records (varchar).

  • 0

I have two tables.

T1 has one column which has 9000 unique records (varchar).

T2 has many columns with upwards of 1 million records. One of the columns T2.x of T2 has data from T1’s column T1.x, however some T2 records have in their column T2.x data that doesn’t exist in T1’s column T1.x. T2.x is also able to be NULL.

I want to list all records of T2, where T2.x has a record that matches T1.x

I tried = SELECT t1.column_x, t2.* from t1, t2 WHERE x = t1.x

However, this only lists 9000 records disregarding the many others that exist in T2.

How can I achieve what I seek?

e.g.

**t1 [x]
===**
a
b
c

**t2
===**     [x]
1 .. .. .. a
2 .. .. .. b
3 .. .. .. eee
4 .. .. .. NULL
5 .. .. .. c
6 .. .. .. a
7 .. .. .. c

I want to get: 1-2-5-6-7

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-30T05:30:16+00:00Added an answer on May 30, 2026 at 5:30 am

    Quite simply the following will work, though it will cause performance issues on that size of table considering both x columns are VARCHAR.

    SELECT
        t2.*
    FROM t2
    INNER JOIN t1
    ON t1.x = t2.x
    

    Do you have an index on the x column already in both t1 and t2, as if so that would help improve query speed. I would recommend NOT running this query in a production environment. If unavoidable, I would have to recommend including LIMIT 10 (or however many rows you need) in order to limit the impact.

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

Sidebar

Related Questions

I have two tables one has a three column composite key. The other needs
I have two tables, each one has a primary ID column as key. I
I have two tables with identical structure except for one column... Table 2 has
I have a column in one of my tables which has been assigned an
Suppose I have two tables that are linked (one has a foreign key to
I have two tables. One (Widgets) has a list of widgets (ID, widget_name, color,
I have two tables, one is a table of forum threads. It has a
I have two tables: object that has object_id column and avalues that have object_id
I have two tables: a 'userlist' that has a 'grade' and 'userID' columns, and
I have two tables that are joined together. A has many B Normally you

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.