list all customers along, title, artist, quantity ordered I am trying to finish
ID: 3556289 • Letter: L
Question
list all customers along, title, artist, quantity ordered
I am trying to finish my script file but continue to get an error saying unknown column I.artist in group statement
Here is my code
Select i.artist, sum (o.order_qty) from items_t left outer join orderline_t o on
i.item_id = o.item_id group by i.artist order by i.artist;
List all customers along with the total revenue received from that customer(revenue would be total retail price )
Select c.customer_name, s2.title, s2.artist,s2.order_qty
from customer_t c left outer join
(Select o1.customer_id ,s.artist,s.title,s.order_qty
from orders_t o1,
(Select s2.artits,s2.title,o.order_id ,o.order_qty
from items_t left outer join orderline_t o on i.item_id=o.item_id) s
where o1.order_id=s.order_id) s2 on c.customer_id=s2.customer_id;
Explanation / Answer
Hi this code sould work.
Select i.artist, sum (o.order_qty) from items_t i left outer join orderline_t o on
i.item_id = o.item_id group by i.artist order by i.artist;
List all customers along with the total revenue received from that customer(revenue would be total retail price )
Select c.customer_name, s2.title, s2.artist,s2.order_qty
from customer_t c left outer join
(Select o1.customer_id ,s.artist,s.title,s.order_qty
from orders_t o1,
(Select s2.artits,s2.title,o.order_id ,o.order_qty
from items_t i left outer join orderline_t o on i.item_id=o.item_id) s
where o1.order_id=s.order_id) s2 on c.customer_id=s2.customer_id;
You forgot to put the alias name "i" after table name, Hence the error. Hope it helped.Do rate :)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.