Printing data with ASP

D

David

Hi,

I have an SQL statement which outputs the following data:

A: RS("SelectorName")
B: RS("SelectorQty")
C: RS("ShipQty")

For each record printed, I need to calculate (B * C), this is easy
enough.
I set up a variable as follows: TMW = RS("SelectorQty") * RS("ShipQty")

The page currently prints as follows:-

96 50
96 100
96 100
96 100

(96 = SelectorName, 50 & 100 = TMW)
<I want to print here : 96 = 350

97 12
97 18
97 53
97 67

<I want to print here : 97 = 150

..... and so on.

Can anyone help me do this ? or explain how to do this.

****** >>>>> Eventually, I just need a page that prints out:
i.e. running through each Selector and printing the sum.

96 = 350
97 = 150

and so on ....... I just though I ought to explain in stages.
 
B

Bob Barrows [MVP]

David said:
Hi,

I have an SQL statement which outputs the following data:

A: RS("SelectorName")
B: RS("SelectorQty")
C: RS("ShipQty")

For each record printed, I need to calculate (B * C), this is easy
enough.
I set up a variable as follows: TMW = RS("SelectorQty") *
RS("ShipQty")


I don't understand why you would not do this in the query?
The page currently prints as follows:-

96 50
96 100
96 100
96 100

(96 = SelectorName, 50 & 100 = TMW)
<I want to print here : 96 = 350

Again, this can be done in the query.

SELECT SelectorName, SUM(SelectorQty * ShipQty) AS total
FROM yourtable
GROUP BY SelectorName
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top