sql - How I get computed column in select statement? -
i have 3 tables.
one product
table , has unitsaleprice
, other table orderproduct
, has column productquantity
(how order particular product) , orders
add detail of customer's orders.
i wrote select
statement this:
select orderprice product, orderproduct, orders orderproduct.product_id = product.product_id , orders.order_id = orderproduct.order_id , orderprice (orderproduct.productqty * product.unitsaleprice) ;
but orderprice
column not in 3 tables , dummy column.
when run query gives error column not exists.
how do this???
you should learn use explicit join
syntax:
select (op.productqty * p.unitsaleprice) orderprice product p join orderproduct op on op.product_id = p.product_id join orders o on o.order_id = op.order_id;
Comments
Post a Comment