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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:26:01+00:00 2026-06-16T05:26:01+00:00

I have four table, and need to help with total sum every price in

  • 0

I have four table, and need to help with total sum every price in each table

1 Table skom

 _________________________________
 | id | noskom      | price_skom |
 |____|_____________|____________|
 |  1 | 1           |   10       | 
 |  2 | 2           |   30       |  
 |__3_|_3___________|___50_______|

2 Table skop

 ______________________________________________
 | id | noskom      | noskop     | price_skop |
 |____|_____________|____________|____________|
 |  1 | 1           |   1        |   10       |  
 |  2 | 1           |   2        |   20       |  
 |  3 | 2           |   3        |    5       | 
 |  4 | 2           |   4        |   30       |  
 |____|_____________|____________|____________|

3 Table npbm

 ___________________________________________________________
 | id | noskom      | noskop     | nonpbm     | price_npbm |
 |____|_____________|____________|____________|____________|
 |  1 | 1           |   1        |   1        |   10       | 
 |  2 | 1           |   1        |   2        |   20       |   
 |  3 | 1           |   2        |   3        |    5       | 
 |  4 | 1           |   2        |   4        |    5       | 
 |  5 | 2           |   1        |   5        |   10       |   
 |  6 | 2           |   2        |   6        |   10       |  
 |  7 | 2           |   2        |   7        |   10       |       
 |____|_____________|____________|____________|____________|

4 Table npbp

 ________________________________________________________________________
 | id | noskom      | noskop     | nonpbm     | nonpbp     | price_npbp |
 |____|_____________|____________|____________|____________|____________|
 |  1 | 1           |   1        |   1        |    1       |   10       | 
 |  2 | 1           |   1        |   2        |    2       |   20       |   
 |  3 | 1           |   2        |   3        |    3       |    5       | 
 |  4 | 1           |   2        |   4        |    4       |    5       | 
 |  5 | 2           |   1        |   5        |    5       |   10       |   
 |  6 | 2           |   2        |   6        |    6       |   10       |  
 |  7 | 2           |   2        |   7        |   10       |   10       |       
 |____|_____________|____________|____________|____________|____________|

and i need help for query like this

 select sum(price_skom),sum(price_skop),sum(price_npbm),sum(price_npbp) from each table group by noskom 

i want result like this

TABLE RESULT GROUP BY noskom

 ________________________________________________________________
 | id | noskom      | sum_skom | sum_skop | sum_npbm | sum_npbp |
 |____|_____________|__________|__________|__________|__________|
 |  1 | 1           |   10     |   30     |    40    |   90     |  
 |  2 | 2           |   30     |   35     |    30    |   70     |      
 |__3_|_3___________|___50_____|__________|__________|__________|

Help me with mysql query

  • 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-16T05:26:03+00:00Added an answer on June 16, 2026 at 5:26 am

    Something like this:

    select 
    noskom, 
    sum (pskom) as sum_skom, 
    sum (pskop) as sum_skop, 
    sum (pnpbm) as sum_npbm, 
    sum (pnpbp) as sum_npbp
    
    from
    (
    select noskom, sum (price_skom) as pskom, 0 as pskop, 0 as pnpbm, 0 as pnpbp from skom group by noskom
    union all
    select noskom, 0, sum (price_skop), 0, 0 from skop group by noskom
    union all
    select noskom, 0, 0, sum (price_npbm), 0 from npbm group by noskom
    union all
    select noskom, 0, 0, 0, sum (price_npbp) from npbp group by noskom
    ) as p
    
    group by noskom
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my app I have a scroll view and four table views. Each time
I used JPA and mysql. Each table have entity class.I have four tables. Table1
I have a table with one column and four rows. Each tr has a
So I have four tables. Each table has a single id for the previous
In my table accounts I have four columns like user, pass, column1, column2 I
i have four tables like below in sql server 2008 : TABLE 1 ->
I have four different tables, one main SPECIAL table containing only id's that reference
I have a table with four Columns: Col1, Col2, Col3, and Col4. Col1, Col2,
I have replaced a table containing four tables (in a grid) with a div-table
I have a fairly static (InnoDB) table T with four columns: A , B

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.