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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:53:43+00:00 2026-05-20T09:53:43+00:00

I have 3 tables: table1:table1_col1, table1_col2,table1_col3 table2 : table1_col1, table2_col2,table2_col3 table3 : table1_col1, table3_col2,table3_col3

  • 0

I have 3 tables:

table1:table1_col1, table1_col2,table1_col3
table2 : table1_col1, table2_col2,table2_col3
table3 : table1_col1, table3_col2,table3_col3

As I tried to explain by the naming, table1:table1_col1 is a unique key that can reference either table2 : table1_col1 or table3 : table1_col1 but never both.
I need to make a join between table1, table2,table3 such that:

join table1 with table2 if table1:table1_col1 = table2 : table1_col1
join table1 with table3 if table1:table1_col1  = table3 : table1_col1

Is this possible in sql syntax?
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-20T09:53:44+00:00Added an answer on May 20, 2026 at 9:53 am

    I would assume you want the corresponding columns from table’s 2 and 3 too.

    select 
          t1.table_col1,
          t2.table2_col2,
          t2.table2_col3,
          t3.table3_col2,
          t3.table3_col3
       from
          table1 t1
             left join table2 t2
               on t1.table1_col1 = t2.table1_col1
             left join table3 t3
               on t1.table1_col1 = t3.table1_col1
    

    Additionally, if you only wanted the columns from respective table 2 or 3, and they were the same data types, you could use the NVL() function, such as

    select 
          t1.table_col1,
          nvl( t2.table2_col2, t3.table3_col2 ) as SecondCol,
          nvl( t2.table2_col3, t3.table3_col3 ) as ThirdCol
       from
          table1 t1
             left join table2 t2
               on t1.table1_col1 = t2.table1_col1
             left join table3 t3
               on t1.table1_col1 = t3.table1_col1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database with two tables ( Table1 and Table2 ). They both
I have 2 tables. Table1 has fields A, B, C, D and Table2 has
I have 3 tables t1,t2,t3 each having 35K records. select t1.col1,t2.col2,t3.col3 from table1 t1,table2
I have two tables with the following columns: table1: id, agent_name, ticket_id, category, date_logged
I have 2 classes with a LINQ association between them i.e.: Table1: Table2: ID
I have the following 3 tables table1 id name ---------- 1 john 2 dave
In a table I have the following schema table1: playerID int primary key, nationalities
I have two tables: Table 1: ID, PersonCode, Name, Table 2: ID, Table1ID, Location,
Assuming I have three tables : TableA (key, value) TableB (key, value) TableC (key,
I have the following code: ListBox.DataSource = DataSet.Tables(table_name).Select(some_criteria = match) ListBox.DisplayMember = name The

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.