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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:50:40+00:00 2026-05-20T07:50:40+00:00

I have 3 tables, with 3 fields all the same. I basically want to

  • 0

I have 3 tables, with 3 fields all the same. I basically want to select information from each table

For example:

userid = 1

I want to select data from all 3 tables, where userid = 1

I am currently using:

   SELECT r.*, 
          p.*, 
          l.*
     FROM random r
LEFT JOIN pandom p ON r.userid = p.userid
LEFT JOIN landom l ON l.userid = r.userid
    WHERE r.userid = '1'
    LIMIT 0, 30

But it doesn’t seem to work.

  • 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-20T07:50:40+00:00Added an answer on May 20, 2026 at 7:50 am

    with 3 fields all the same

    So you mean that you want the same 3 fields from all 3 tables?

       SELECT r.col1, r.col2, r.col3
         FROM random r
        WHERE r.userid = '1'
        LIMIT 0, 30
    UNION ALL 
       SELECT p.pcol1, p.pcol_2, p.p3
         FROM pandom p
        WHERE p.userid = '1'
        LIMIT 0, 30
    UNION ALL 
       SELECT l.l1, l.l2, l.l3
         FROM landom l
        WHERE l.userid = '1'
        LIMIT 0, 30
    

    The fields don’t have to be named the same, but the same types need to line up in position 1, 2 and 3.

    The way the limits work is:

    • it will attempt to get 30 from random.
    • If it has 30 already, it won’t even look at the other 2 tables
    • if it has less than 30 from random, it will try to fill up to 30 from pandom and only finally landom
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a few tables that have similar fields but not exactly the same.
I have a table in MySQL that has 3 fields and I want to
I have a table that contains some blob fields that I don't want to
I have 2 tables. Table1 has fields A, B, C, D and Table2 has
I have two tables, both with start time and end time fields. I need
I have a contacts table which contains fields such as postcode , first name
Suppose I have a database table with two fields, foo and bar. Neither of
I have two tables in a DataSet where the ID field on each is
If I have a table with two foreign key fields to another table, I.E.
I have 2 tables: tab1 ( field1, field2, field3 ) tab2 ( field1, field2,field3,

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.