simple sum question

T

Ted Wilson

I have a table with a 4 fields, customer name, order number, price and
product name. I want to be able to select customer name and orders and do a
sum of the prices to display the total on my ASP page. How can I do SQL to
create a record set to display this?

many thanks

Ted
 
T

Tom Wickerath

Hi Ted,

I'm not an ASP guru, but something like this should be close:

SELECT [customer name], Sum(price) AS [Total Purchased]
FROM [YourTableName]
GROUP BY [customer name];


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

I have a table with a 4 fields, customer name, order number, price and
product name. I want to be able to select customer name and orders and do a
sum of the prices to display the total on my ASP page. How can I do SQL to
create a record set to display this?

many thanks

Ted
 
B

Brendan Reynolds

Are you looking for the total price per order? If so, the SQL would be ...

SELECT [customer name], [order number], Sum(price) AS TotalPrice FROM
TableName GROUP BY [customer name], [order number]
 
Top