0

I want to show the quantity and Lbs purchased per customer on a web page without showing duplicate customers. The output value of total lbs is derived from retrieving the total lb in that type of package i.e. 6 for a 6 lbs per package, then in VBScript multiplying it by the quantity in that row.

<% Customer = ("CustomerName") Qty = ("Qty") ItemLbs = ("Lbs") * Qty %> 

It works fine without SUMing the customer names but when the duplicate customer names are SUMed the VB equation outputs incorrect information.

I would Like to corect this either via VBScript or SQL

1 Answer 1

1

Use GROUP BY and have SQL do it for you:

SELECT CustomerName,sum(qty*lbs) AS TotalWeight FROM yourtable GROUP BY CustomerName 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.