title: Group data by age, gender and report requested in MySQL
body: <p>I'm having trouble formulating my MySQL statement / query string. I have a table (see sample below) </p>
  
  <p><img src="https://i.stack.imgur.com/mP0PO.png" alt="MySQL sample Table"></p>
  
  <p>It's a sample table containing gender, age and report_requested fields. What I would like to have as an output is something like this: </p>
  
  <pre><code>20 years old, male | Total number of users | Total who requested min 1 report | total who requested 2 reports | total 3 or more reports
  
  20 years old female | Total number of users | Total who requested min 1 report | total who requested 2 reports | total 3 or more reports
  
  20 years old combined | Total number of users | Total who requested min 1 report | total who requested 2 reports | total 3 or more reports
  
  21 years old, male | Total number of users | Total who requested min 1 report | total who requested 2 reports | total 3 or more reports
  
  21 years old female | Total number of users | Total who requested min 1 report | total who requested 2 reports | total 3 or more reports
  
  21 years old combined | Total number of users | Total who requested min 1 report | total who requested 2 reports | total 3 or more reports
  </code></pre>
  
  <p>... etc.</p>
  
  <p>But I'm having a hard time with it. What I just know is to determine the number of users who requested (1,2,3,...etc) credit reports given the gender and age.</p>
  
  <p>Here's what I used:</p>
  
  <pre><code>SELECT COUNT(*) as cnt, report_requested 
  FROM sampletable WHERE age = '39' 
  AND gender = 'M' GROUP BY report_requested
  </code></pre>
  
  <p>Here's the result:</p>
  
  <p><img src="https://i.stack.imgur.com/UlizR.png" alt="enter image description here"></p>
  
  <p>It just return the data for 20 yrs old male, number of users requested 1 credit report, 2 credit reports up to 8 (but this is also wrong since it should combine the number of users who requested 3 credit reports or more)</p>
  
  <p>Can anybody here help me or give me an idea on how I could accomplish this?</p>