title: Oracle - How to use avg(count(*)) on having clause or where clause?
body: <p>I have data like this:</p>
  
  <pre><code>CONCERT_ID   EVENT_ID ATTENDANCE AVG_ATTENDANCE_EACH_CONCERT
  ---------- ---------- ---------- ---------------------------
           1          1          1                         1,5
           1          2          2                         1,5
           3          5          2                           2
           3          6          2                           2
           5         11          4                           2
           5         12          1                           2
           5         13          1                           2
  </code></pre>
  
  <p>Thats from this query:</p>
  
  <pre><code>select concert_id, event_id, count(customer_id) attendance,
  avg(count(*)) over (partition by concert_id) avg_attendance_each_concert
  from booking
  group by concert_id, event_id
  order by event_id;
  </code></pre>
  
  <p>How to make a limitation on that query. What i want to make is </p>
  
  <p><strong>If the attendance is below average attendance show result</strong></p>
  
  <p>I already tried avg(count(*)) over (partition by concert_id) to having clause but gave me an error group function is too deep</p>