Calculating total amounts per clientid

From: MT <m_tessier(at)sympatico(dot)ca>
To: Pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Calculating total amounts per clientid
Date: 2003-12-13 19:21:21
Message-ID: 20031213142121.7e43075f.m_tessier@sympatico.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I have an invoicing system using postgresql. Each time a customer makes a purchase, a new record is inserted into the "cart" table. The "cart" table, among other things, contains a customer_id field and a total for the amount purchased on the particular invoice. Now what I'd like to do is to calculate the total invoices for each customer in a given time interval, then list those customers in descending order from most paying to least paying. Could someone give me some pointers on how to construct an sql statement that would flush out this data.

Thanks for your help,

Mark

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martin Marques 2003-12-13 19:36:32 Re: Calculating total amounts per clientid
Previous Message Peter Eisentraut 2003-12-13 19:05:50 Re: Why is postgres an ORDMS