I'm trying to solve this question using Inner Join but I keep getting errors
List the customer number, order number, order date, and order total for each order with a total that exceeds $500. Assign the column name ORDER_TOTAL to the column that displays order totals. Order the results by order number.
ORDERS table has CUSTOMER_NUM, ORDER_NUM, and ORDER_DATE
ORDER_LINE has ORDER_NUM, ITEM_NUM, NUM_ORDERED, and QOUTED_PRICE
This is my solution:
SELECT CUSTOMER_NUM, ORDERS.ORDER_NUM, ORDER_DATE, SUM(QUOTED_PRICE) AS ORDER_TOTAL
FROM ORDERS
INNER JOIN ORDER_LINE ON ORDERS.ORDER_NUM = ORDER_LINE.ORDER_NUM
GROUP BY ORDER_NUM
HAVING ORDER_TOTAL > 500;
The error I'm getting:
Error starting at line : 61 in command -
SELECT CUSTOMER_NUM, ORDERS.ORDER_NUM, ORDER_DATE, SUM(QUOTED_PRICE) AS ORDER_TOTAL
FROM ORDERS
INNER JOIN ORDER_LINE ON ORDERS.ORDER_NUM = ORDER_LINE.ORDER_NUM
GROUP BY ORDER_NUM
HAVING ORDER_TOTAL > 500
Error at Command Line : 65 Column : 8
Error report -
SQL Error: ORA-00904: "ORDER_TOTAL": invalid identifier
00904. 00000 - "%s: invalid identifier"
Any suggestions?