Re: Avoiding aggregation using stored procedures

message from gjarmiolowski on 15 Jul 2004
Cuban Allstar,

It sounds like you want to find the products for a specific customer and then
be able display the values of A-I for each prodcut ID.

Where you have this
SELECT (((100 - RM) * SELLINGPRICE) * TONNESPERANNUM) / 100 AS
ANNUALCONTRIBUTION
FROM product
WHERE CUSTID = MMColParam

(Where MMColParam = Request.QueryString=("CUSTID") )

You probably need this
SELECT product_id, SUM((((100 - RM) * SELLINGPRICE) * TONNESPERANNUM) / 100)
AS ANNUALCONTRIBUTION
FROM product
WHERE CUSTID = MMColParam
GROUP BY product_id

This will aggregate over the product for the customer, rahter than all
products for the customer.

Just a guess. Maybe you could post more SQL and description of the tables if
not.
 

Archived message: Re: Avoiding aggregation using stored procedures (Macromedia Dreamweaver)