title: Google Analytics Certificate (Aggregations of aggregations are not allowed)
body: <blockquote>
  <p>I am trying to follow along with the google anaylytics certificate course video. I copied the instructor's screen, word for word and run into the error &quot;Aggregations of aggregations are not allowed.&quot;</p>
  </blockquote>
  <blockquote>
  <p>**It's the HAVING part that triggers the error.</p>
  </blockquote>
  <pre><code>SELECT
    warehouse.warehouse_id,
    CONCAT(warehouse.state, ': ', warehouse.warehouse_alias) AS warehouse_name,
    COUNT(orders.order_id) AS orders,
      (
        SELECT
          COUNT(*)
        FROM
          warehouse_orders.orders orders
          ) AS Total_Orders,
        CASE
          WHEN COUNT(orders.order_id)/(SELECT COUNT(*) FROM warehouse_orders.orders orders)&lt;=.20
          THEN &quot;fulfilled 20% of orders&quot;
          WHEN COUNT(orders.order_id)/(SELECT COUNT(*) FROM warehouse_orders.orders orders)&gt;.20
          AND COUNT(orders.order_id)/(SELECT COUNT(*) FROM warehouse_orders.orders orders)&lt;=.60
          THEN &quot;Fulfilled 21%-60% of orders&quot;
          ELSE &quot;Fulfilled more than 60% of orders&quot;
        END AS Fulfillment_Summary 
   FROM
    warehouse_orders.warehouse AS warehouse
    LEFT JOIN warehouse_orders.orders AS orders
      ON orders.warehouse_id = warehouse.warehouse_id
  GROUP BY
    warehouse.warehouse_id,
    warehouse_name
  HAVING
    COUNT(orders.order_id) &gt; 0 
  </code></pre>