Re: sql+ [message #370232] |
Tue, 16 March 1999 11:55 |
Chris Hunt
Messages: 27 Registered: March 1999
|
Junior Member |
|
|
You're clearly a busy man James, but do you think you could spare the time to tell us a little more about your database? Like, what tables you store the purchase information in. It makes it a whole lot easier to answer your question.
If you had the simplest possible arrangement, you could do this..
SELECT customerID,COUNT(*),SUM(price)
FROM purchases
GROUP BY customerID
You probably have a more complex arrangement, splitting the price off into a separate "product" table, but I'll leave you to figure out how to adapt the above to your circumstances (whatever they may be)
|
|
|