sql - Having trouble getting results from this query. What am I doing wrong? -
write sub-query returns total number of orders placed customer highest number of orders. include customerid , number of orders placed.
use northwind go select customerid, count(orders.orderid) totalorders, sum(orderamounts.dollaramount) totaldollaramount [orders] left outer join (select orderid, sum(quantity*saleprice) dollaramount orderitems group orderid) orderamounts on orders.orderid = orderamounts.orderid group customerid order count(orders.orderid) desc
i response: msg 208, level 16, state 1, line 1 invalid object name 'orderitems'.
???
is table orderitems
member of northwind database or somewhere else? may have qualify [databasename].dbo.[orderitems]
Comments
Post a Comment