I am in need of some help with calculations. I have the following set up in a database.
The Inventory has current prices and the Bill has prices at time of purchase. Now I am trying to build a query that will output the bill for a given OrderID. I need it to output:
InvDesc, Qty, PriceFirst, PriceAddtl, PriceTotal
The PriceTotal is given for each record as
PriceTotal = PriceFirst + (PriceAddtl * (Qty-1))
This is where I am stuck, how do I get the query to output each record and the total price? I put the query together to output the data for each record, but I can't figure out how to calculate the total price in SQL. Please help if you can.
Thanks,
Axoliien
Code:
[b]tbl_Orders[/b]
OrderID (AutoNumber)
OrderInfo (Other stuff)
Primary Key (OrderID)
[b]tbl_Inventory[/b]
InvID (AutoNumber)
InvDesc (VarChar 64)
InvPriceFirst (Currency)
InvPriceAddtl (Currency)
Primary Key (InvID)
[b]tbl_Bill[/b]
OrderID (FK, Integer)
InvID (FK, Integer)
Qty (Integer)
PriceFirst (Currency)
PriceAddtl (Currency)
Primary Key (OrderID, InvID)
The Inventory has current prices and the Bill has prices at time of purchase. Now I am trying to build a query that will output the bill for a given OrderID. I need it to output:
InvDesc, Qty, PriceFirst, PriceAddtl, PriceTotal
The PriceTotal is given for each record as
PriceTotal = PriceFirst + (PriceAddtl * (Qty-1))
This is where I am stuck, how do I get the query to output each record and the total price? I put the query together to output the data for each record, but I can't figure out how to calculate the total price in SQL. Please help if you can.
Thanks,
Axoliien