Derived colomns, how do you do them?

Chunk

Registered User.
Local time
Today, 19:57
Joined
Oct 25, 2004
Messages
64
I have the attribute "order_line_price". I want to be able to calculate a value to put into it, depending on the product in the order line and the quantitiy in the order line.

How can I get a query to use the value that has been selected in the product_number field of the order_line table, to calculate the order_line_price?

Here is more detail on my tables:

Order_line table:

product_number (FOREIGN KEY)
quantity
order_line_price


Product table:

product_number (Primary key)
price_band (FOREIGN KEY)


Price_band table:

price_band (PRIMARY KEY)
price


With all that in mind, here is the query I have written:

SELECT price
FROM (Product INNER JOIN Order_line ON Product.product_number=Order_line.product_number) INNER JOIN Price_band ON Product.price_band=Price_band.price_band;

Ive got all the tables joined up. I now need to be able to pick out the rows which apply to the row i am trying to calculate an order_line_price for.

Any ideas please?
 

Users who are viewing this thread

Back
Top Bottom