Question: Microsoft SQL Server Management Studio: Show just the customer contact name of the customer with the most orders ( Fig. 2 ). Do not use

Microsoft SQL Server Management Studio:

Show just the customer contact name of the customer with the most orders (Fig. 2). Do not use any hard-coded values or row numbers.

I wrote the SQL Script below and it pulled 89 rows (Fig 1). I need an SQL Code to pull the customer contact name of the customer with the most orders (Fig. 2).

SQL Script:

SELECT T.contactname, (T.OrderCount) AS 'Number Of Orders'

FROM(SELECT contactname, COUNT(O.orderid) AS OrderCount

FROM Sales.Orders O

INNER JOIN Sales.Customers C

ON o.custid = c.custid

GROUP BY contactname) AS T

Microsoft SQL Server Management Studio: Show just the customer contact name of

Fig. 1 contactname Number Of Orders 9 Mallit, Ken 50 Marinova, Nadejda 51 McLin, Nkenge 52 Meston, Tosh 53 Misiec. Anna 54 Moore, Michael 55 Myrcha, Jacek 56 Nagel, Jean-Philippe 57 Navarro, Toms 58 O Brien, Dave 59 Osorio, Cristian 60 Peoples, John 61 Poland, Carole 10 10 13 18 10 6 31 Fig. 2 contactname Number of Orders Navarro, Toms31

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!