select top 1 [CustomerId],count([OrderId]) as NoOfOrders from [dbo].[tbl_Order] group by [CustomerId] order by NoOfOrders desc
SELECT customerid, COUNT(customerid) AS CountOfCust FROM TableName GROUP BY customerid
MAX()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)