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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:27:29+00:00 2026-06-05T00:27:29+00:00

I have two tables (inputs and categories): CREATE TABLE categories ( iId INTEGER NOT

  • 0

I have two tables (inputs and categories):

CREATE TABLE categories (
    iId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
    sName TEXT NOT NULL,
    iParent INTEGER,
    FOREIGN KEY (iParent) REFERENCES categories(iId)
);

CREATE TABLE inputs (
    iId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
    iCategory INTEGER,
    dValue DOUBLE NOT NULL,
    FOREIGN KEY (iCategory) REFERENCES categories(iId)
);

I need get the sums(dValue column) from inputs table for each category. Even if the sum result is zero.

If is it possible would be better if I could get the sum for each Parent Category ( when categories.iId = categories.iParent, summing the results of the child categories to the parent category )

Can anyone help me? I appreciate any help!
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-05T00:27:30+00:00Added an answer on June 5, 2026 at 12:27 am

    Try this:

    select c.iParent, sum(i.dValue)
    from categories c
    left outer join inputs i on i.iCategory=c.iId
    group by c.iParent
    

    EDIT : With accounts:

    select c.iParent, a.iCurrency, sum(i.dValue)
    from categories c
    left outer join inputs i on i.iCategory=c.iId
    left outer join accounts a on i.iAccount=a.iId
    group by c.iParent,a.iCurrency
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables like this: CREATE TABLE table1_lang ( id serial NOT NULL,
I have two tables: A lookup table ( tabOne ): KEY | Group |
I have two tables, namely Price List (Table A) and Order Record (Table B)
I have two tables Orders table and customers table, both have customerid as common
Suppose I have two tables 1st table emp EmpID | EmpName|xyz...coloums 1. | Hrishi
I have two tables in my database cars and car_types. cars table refers to
Let's say I have two Databases like so : DatabaseA create table Table1 (
I have two tables with a many-to-one relationship. (Oracle) **Table: PARENT** Field: A (PK)
I have two tables tied by a foreign key. Example: Customer -> CustomerType I've
I have two tables. The first table holds simple user data and has the

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.