Adding Postgres table cells based on same value
Posted
by russell kinch
on Stack Overflow
See other posts from Stack Overflow
or by russell kinch
Published on 2010-05-04T17:02:42Z
Indexed on
2010/05/04
17:08 UTC
Read the original article
Hit count: 235
I have a table called expenses. There are numerous columns but the ones involved in my php page are date, spplierinv, amount. I have created a page that lists all the expenses in a given month and totals it at the end. However, each row has a value, but many rows might be on the same supplier invoice.This means adding each row with the same supplierinv to get a total as per my bank statement. Is there anyway I can get a total for the rows based on the supplierinv. I mean say I have 10 rows. 5 on supplierinv 4, two on supplierinv 5 and 3 on supplierinv 12, how can a get 3 figures (inv 4, 5 and 12) and the grand total at the bottom. Many thanks
© Stack Overflow or respective owner