Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2006
    Posts
    15

    Unanswered: Sub and grandtotals?

    Hi

    Got a table A in postgresql
    schema:
    site item cost
    zzz aaaa 20
    aaa bbbb 30
    rrrr cccc 10

    There are a lot of site linked to different items.
    The cost column is displayed in query.

    I want a grandtotal at the end displaying the totalcost of all the items in query.

    Any ideas....?

    Thanks in advance.

  2. #2
    Join Date
    Apr 2006
    Posts
    9

    Hope this works

    Maybe you can run another query at the end of the previous query like

    select sum(cost) as grand_total from A;

    Another method which i think is possible is little more complex i.e.

    "create aggregate"

    you can look more for create aggregate at

    http://www.postgresql.org/files/docu...l/node211.html


    Thanks,
    Sumeet

  3. #3
    Join Date
    Mar 2006
    Posts
    15
    Thanks

    I want to display only specific items which are allocated between this table and a next so my grand total query would have to be included in first query.
    So I'll have to go with the create aggregate option

    Thanks for reply

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •