czechmate1976
asked on
Math operations in SQL query
I have this query:
SELECT orders.issuedate, supplier.supname, orderline.ordref, product.prodcode, product.producttitle, orderline.quantity,
productprice.costprice, productprice.vat, productprice.costprice+pro ductprice. vat as itemcost, quantity*itemcost as itemtotal
FROM orderline, product, productprice, orders, supplier
WHERE orders.ordref = orderline.ordref
AND orders.supid = supplier.supid
AND product.prodcode = productprice.prodcode
AND orderline.prodcode = product.prodcode
AND supname = 'Toyshop'
AND productprice.enddate is null
ORDER BY ORDREF
.. and get this error:
Error at Command Line:2 Column:104
Error report:
SQL Error: ORA-00904: "ITEMCOST": invalid identifier
00904. 00000 - "%s: invalid identifier"
I am trying to create a derived attribute - item total that shows price including vat and then multiply this 'item total' by the quantity to get the total price for an item on an order.
How can I do it. Can someone help me find the solution to this? Thanks a lot
SELECT orders.issuedate, supplier.supname, orderline.ordref, product.prodcode, product.producttitle, orderline.quantity,
productprice.costprice, productprice.vat, productprice.costprice+pro
FROM orderline, product, productprice, orders, supplier
WHERE orders.ordref = orderline.ordref
AND orders.supid = supplier.supid
AND product.prodcode = productprice.prodcode
AND orderline.prodcode = product.prodcode
AND supname = 'Toyshop'
AND productprice.enddate is null
ORDER BY ORDREF
.. and get this error:
Error at Command Line:2 Column:104
Error report:
SQL Error: ORA-00904: "ITEMCOST": invalid identifier
00904. 00000 - "%s: invalid identifier"
I am trying to create a derived attribute - item total that shows price including vat and then multiply this 'item total' by the quantity to get the total price for an item on an order.
How can I do it. Can someone help me find the solution to this? Thanks a lot
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER