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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:14:41+00:00 2026-06-16T22:14:41+00:00

I currently have 5 tables: trialSum ————- id total ————- 1 2000 2 1000

  • 0

I currently have 5 tables:

trialSum
-------------
id    total
-------------
1     2000
2     1000
3     500

trialLand
-------------
id    total
-------------
1     1000
2     250
3     500

trialImp
-------------
id    total
-------------
2     250

trialBldg
-------------
id    total
-------------
1     1000
2     500

trial
---------------------
id    name     info
---------------------
1     xxxxx    xxxxx
2     xxxxx    xxxxx
3     xxxxx    xxxxx
4     xxxxx    xxxxx

The trial table will have the most entries into and all of the “id” fields match up with each other. Each table will have over 7000 entries in them. I am trying to create one big table that looks like:

    trial
    ----------------------------------------------------------------------
    id    name     info    totalSum    totalLand    totalImp    totalBldg
    ----------------------------------------------------------------------
    1     xxxxx    xxxxx    2000        1000         0           1000
    2     xxxxx    xxxxx    1000        250          250         500
    3     xxxxx    xxxxx    500         500          0           0
    4     xxxxx    xxxxx    0           0            0           0

If I do a giant MySQL query that has 4 left joins, it take over 40 minutes to complete. There has to be an easier way. 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-16T22:14:42+00:00Added an answer on June 16, 2026 at 10:14 pm

    I would say that, the left join is indeed a good way to do this. Do you have indexes on those id columns? Try adding indexes and the speed should improve. Remember to use EXPLAIN to confirm the indexes are being used appropriately. More on EXPLAIN http://www.dbtuna.com/article.asp?id=14 .

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

Sidebar

Related Questions

I currently have 3 tables: News ID | Title Tag ID | Name TaggedContent
I currently have 3 tables: Drug id name DrugAlias drug_id name Patient first_name last_name
I currently have 3 simple tables: products (prodid, name and prodmatid), materials (matid, name)
I currently have 4 tables. Product, Category, SubCategory, ProductSubCategory. Category has a OneToMany SubCategory
I need some advice of how to setup my tables I currently have a
Greetings, I have some mysql tables that are currently using an md5 hash as
I currently have two tables, one is products and the other is options (colour,
I currently have two tables, one for pages (objects) and one for images (media).
I currently have two tables similar to users and programs that are linked through
I currently have multiple tables in my database which consist of the same 'basic

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.