Question: Getting an error: Error Code: 1 0 6 6 . Not unique table / alias: 'order _ line'. Please help correct the code and provide

Getting an error:
Error Code: 1066. Not unique table/alias: 'order_line'. Please help correct the code and provide an updated query.
SELECT customer.first_name, customer.last_name, sum(order_line.quantity_sold * product.product_price) as Ordertotal
FROM customer, order_line
INNER JOIN orders ON orders.customer_Id = customer.customer_id
INNER JOIN (
SELECT order_id
FROM order_line
INNER JOIN product ON product.product_id = order_line.product_id
GROUP BY order_id
) AS orders ON orders.order_id = order_line.order_id
WHERE order_line.ordertotal >(
SELECT AVG(SUM(quantity_sold * product_price))
FROM order_line, product
INNER JOIN order_line ON order_line.product_id = product.product_id
GROUP BY order_line.order_id
);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!