• In that case try:

    Select Count(orderNo) as COrders, Month as theMonth into #TempCustOrders

    From Orders

    Where CustId = @CustId

    Group by Month

    Select t.COrders as CustOrders, Count(OrderNo) as TotalMonthOrders, Month

    From Orders

    inner Join #TempCustOrders t on t.theMonth = Month

    Group by t.COrders, Month

    Drop Table #TempCustOrders