Advice on how to build a query with partial sums - Mailing list pgsql-novice

From JORGE MALDONADO
Subject Advice on how to build a query with partial sums
Date
Msg-id CAAY=A78MbAskov=93Jec2=QGjsGvowdbHk0ywdjY+HVwRkT4iA@mail.gmail.com
Whole thread Raw
Responses Re: Advice on how to build a query with partial sums
List pgsql-novice
I need to build a query for the sample data below:

-----------------------------------------------------------------------    --------
fte_clave    fte_padre    fte_porc    fte_porc_aux         total
-----------------------------------------------------------------------    --------
1                  1                25              25                   50
2                  1                25               0                    50
3                  1                50              25                   50

4                  2                20               0                    40
5                  2                20              25                   40
6                  2                60              15                   40

7                  3                15              35                   60
8                  3                15               0                    60
9                  3                20               0                    60
10                3                50              25                   60
-----------------------------------------------------------------------    -------

The table contains only the first 4 fields and I want to build a query that gets such fields plus a fifth one (total) with the sum of "fte_porc_aux" for each "fte_padre".

I will very much appreciate your comments.

pgsql-novice by date:

Previous
From: Jack Kaufman
Date:
Subject: Re: Sending email from PL/pgSQL
Next
From: David Johnston
Date:
Subject: Re: Advice on how to build a query with partial sums