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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:51:57+00:00 2026-06-17T10:51:57+00:00

I have 4 tables all with the same primary key with structure like :

  • 0

I have 4 tables all with the same primary key with structure like :

table_1 : u_id | col1 | col2    

table_2 : u_id | col3 | col4     

table_3 : u_id | col5 | col6    

table_4 : u_id | col7 |  col8

I want to fetch the data of "col1", "col4", "col6" and "col7" on the basis of the value of u_id.

Values of u_id are same in every table.

For eg. if u_id='8', then fetch all the specified column values where u_id='8'.

I am not using joins correctly, i guess.

Thanks.

  • 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-17T10:51:59+00:00Added an answer on June 17, 2026 at 10:51 am

    This should be pretty straight forward. Use INNER JOIN

    SELECT  a.col1, b.col4, c.col6, d.col7
    FROM    table1 a
            INNER JOIN table2 b
                ON a.u_id = b.uid
            INNER JOIN table3 c
                ON a.u_id = c.uid
            INNER JOIN table4 d
                ON a.u_id = d.uid
    WHERE   a.u_ID = 8
    

    To learn more about joins, please see the article below.

    • Visual Representation of SQL Joins
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tree structure table like, Table{Id, ParentId, Name} where Id is primary key,
I have 8 tables, and all of the tables have exactly the same structure.
I have a load of tables all with the same 2 datetime columns (lastModDate,
I have 3 similar tables, that would all have the same enum type field.
I have 3 database tables, all of them have the same 5 columns. They
I have about 100 tables where all of them have duplicate foreign key constraints
I have an SQL table with basically the following structure: PK (int, primary key),
I have two tables as below: users -id (primary key, AUTO_INCREMENT) -username (varchar) -password
I have 2 tables in which about 80% of primary keys is the same.
i have innodb tables (all of them are in the same file, and this

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.