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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:12:06+00:00 2026-06-10T13:12:06+00:00

here is my problem. I have two tables, Table1 – id | Name |

  • 0

here is my problem.

I have two tables,

Table1 –

id | Name | Code
1  | test | 4
2  | test | 5
3  | test4| 6
4  | test4| 7
5  | test | 8
6  | test | 9

Table2 –

id | Code
1  | 4
2  | 5
3  | 6
4  | 7
5  | 8
6  | 9

Here the Code column is the same in the both tables, what I’m trying is, I’m having the Code From Table2 AND I’m selecting the other table with it. For example

SELECT * FROM Table2 LEFT JOIN Table1.Code = Table2.Code WHERE Table2.Code = 4 , that’s fine, now I’m getting the results from both tables for the same Code, but now, from that point when I have Table1, I want to get All the rows With the same Name . The expected result I want is

id | Name | Code
1  | test | 4
2  | test | 5
5  | test | 8
6  | test | 9
  • 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-10T13:12:07+00:00Added an answer on June 10, 2026 at 1:12 pm

    You can try something like

    SELECT  *
    FROm    Table1 t1
    WHERE   Name IN (
                        SELECT  t1.Name
                        FROM    Table1 t1 INNER JOIN
                                (
                                    SELECT  id,
                                            Code
                                    FROM    Table2 
                                    WHERE   Table2.Code = 4
                                ) t2    ON  t1.id = t2.id
                                        AND t1.Code = t2.Code
                    )
    

    or even

    SELECT  *
    FROm    Table1 t1
    WHERE   Name IN (
                        SELECT  t1.Name
                        FROM    Table2 t2 INNER JOIN
                                Table1 t1   ON  t2.id = t1.id
                                            AND t2.Code = t1.Code
                        WHERE   Table2.Code = 4
                    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bit of an architecture problem here. Say I have two tables,
I'm facing a problem here : I have two tables : A users table
Ok, I've got an interesting problem here. I have two tables, tips and votes.
So here's my problem. I have two tables, photos and users_homepage_photos . In my
So here's my problem. I have three tables: Person Table person_id, name Events Table
Here is the problem: I have two columns in a table that, for each
I have a problem with a mutating table in Oracle. I have two tables,
Ok here it is. i have two tables: products and product_sizes so basically my
Here's my situation. I have two tables: pledges and pledge_transactions. When a user makes
Hi I'm struggling with the following problem. I have two tables one with employee

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.