Forums

ASP

This topic is locked

QTY * Price calculation

Posted 07 Apr 2007 14:26:02
1
has voted
07 Apr 2007 14:26:02 aaron bird posted:
Hi.

Here is my problem. I basically have a recordset which gets information from 3 tables in my database. One of the table hold the price of a product, and another holds QTY ordered. I can sucessfully call the correct information. However, what i wish to be able to do now is to create a coloum which calculates the total price (QTY * Price) for that row.

Any Ideas

Thanks

Aaron

Replies

Replied 07 Apr 2007 17:23:54
07 Apr 2007 17:23:54 Javier Castro replied:
Have you tried:

SELECT SUM (qty * Price) AS total
FROM yourTable
WHERE ....

Hope it helps
Replied 08 Apr 2007 18:03:06
08 Apr 2007 18:03:06 aaron bird replied:
OK, got a new problem now.

This time i am selecting a Machine from machine tables. In this tables Weekly_running_cost is held.

What i want to able to do is select the machine from a drop down, then enter the number of weeks. Then when this form is subbmitted the figure for Weekly_running_cost * Weeks to be displayed

So far i have managed to get the drop down, and an input box for number of weeks. Then my results display the Machine_Name, Weekly_Running_cost and the number of weeks that the user entered, but am unsure on how to do the calculation for the row.

Any help would be nice.

Thanks

Reply to this topic