Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

Students also viewed these Databases questions