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

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -