tbi_Customer tbl_order
CustId int orderid int
Customer no OrderName varchar(50)
CustId int
答案 0 :(得分:0)
试试这个
select top 1 a.customerno,b.totalorder from tbl_Customer as a
join (select custid,count(custid) as totalorder from tbl_order group by custid) b on a.custid=b.custid
order by b.totalorder desc