select customer.customerId,customer.customerName,count(orders.orderId) as orderCount from  customer inner join orders on customer.customerId=orders.customerId group by customer.customerId,customer.customerName order by orderCount desc

解决方案 »

  1.   

    Select orders.orderId,orders.customberId,customber.customberName From orders Join customer Where orders.custombeId = customber.custombeid Order By orders.orderId
      

  2.   

    按照 orders 表中的记录数量排序
    -------------------------
    是不是想按order表中每个customer对应的order的数量排序?select c.*,count(o.orderId) as oc 
    from customer c, orders o
    where c.customerId=o.customerId
    group by o.customerId
    order by oc