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

  • Home
  • SEARCH
  • 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 8441161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:29:37+00:00 2026-06-10T08:29:37+00:00

TB1, TB2, TB3 are in one database on the server and TB4 is on

  • 0

TB1, TB2, TB3 are in one database on the server and TB4 is on another database.

The column information needed for the join are as follows:

  • TB1 – column a1, b2.
  • TB2 – column a2, b2, c3.
  • TB3 – column a3.
  • TB4 – column a4.

TB1, TB2, TB3 are related by ID
TB1’s ID is the primary key and the foreign keys in TB2, TB3 and TB4

I am using SQL Server Management Studio

Code:

select ID
from TB1, TB2, TB3
where TB1.ID = TB2.TB1.ID

  • 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-10T08:29:39+00:00Added an answer on June 10, 2026 at 8:29 am

    You can link them like this (don’t forget to put the relation that you missed to say):

    SELECT t1.a1, t1.b2, t2.a2, t2.b2, t2.c3, t3.a3, t4.a4
    FROM db1..TB1 t1
    INNER JOIN db1..TB2 t2 ON t1.ID = t2.ID
    INNER JOIN db1..TB3 t3 ON t1.ID = t3.ID
    INNER JOIN db2..TB4 t4 ON --put relation here
    

    Also replace db1 and db2 by the database names on which each table is present.


    One final note, your code it’s giving redundant information because you didn’t make all the restrictions. So, a cartesian product is produced.

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

Sidebar

Related Questions

SELECT tb1.booking_ref, tb1.investor, tb2.cost, tb3.product FROM tb1, tb3 LEFT JOIN tb2 ON tb1.booking_ref =
I have 10 text boxes namely TB1, TB2, TB3, TB4 and so on.. to
I have the id of the TextBoxes as tb1, tb2, tb3 and the text
So I have a sql server 2008 database with 9 tables in them, they
I have a series of TextBlock Controls, like this: <TextBox Name=tb1/> <TextBox Name=tb2/> <TextBox
SELECT distinct source_IP, timestamp FROM tb1 , tb2 WHERE tb1.source_IP not in ( SELECT
I want to execute an SQL query like: select 'tb1'.'f1','tb1'.'f2','tb2'.'f1' from 'tb1','tb2'; Now the
Well i got 3 tables: tb1: tb1_id PK tb1_name tb2: tb2_id PK tb1_id FK
I need to cross reference 2 tables. within tb1 is booking_ref, investor within tb2
I have asp.net page (Form = runat server ) 2 textboxes: <input type=text id=tb1

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.