title: Combine data BigQuery
body: <p>I'm quite new to firebase and bigQuery, but I'm collecting the data displayed below from Unity. And I would like to create a table out of this (cyclist 1 question 2 pre).</p>
  <pre><code>SELECT COUNT(CASE WHEN event_name = 'cyclist1_question2_pre' AND param.key = 'mood_age_1' AND param.value.int_value = 1 THEN param.value.int_value END) AS C1_pre_relaxed_1,
         COUNT(CASE WHEN event_name = 'cyclist1_question2_pre' AND param.key = 'mood_age_2' AND param.value.int_value = 1 THEN param.value.int_value END) AS C1_pre_relaxed_2,
         COUNT(CASE WHEN event_name = 'cyclist1_question2_pre' AND param.key = 'mood_age_3' AND param.value.int_value = 1 THEN param.value.int_value END) AS C1_pre_relaxed_3,
         COUNT(CASE WHEN event_name = 'cyclist1_question2_pre' AND param.key = 'mood_age_4' AND param.value.int_value = 1 THEN param.value.int_value END) AS C1_pre_relaxed_4,
         COUNT(CASE WHEN event_name = 'cyclist1_question2_pre' AND param.key = 'mood_age_1' AND param.value.int_value = 2 THEN param.value.int_value END) AS C1_pre_investigative_1,
         COUNT(CASE WHEN event_name = 'cyclist1_question2_pre' AND param.key = 'mood_age_2' AND param.value.int_value = 2 THEN param.value.int_value END) AS C1_pre_investigative_2,
         COUNT(CASE WHEN event_name = 'cyclist1_question2_pre' AND param.key = 'mood_age_3' AND param.value.int_value = 2 THEN param.value.int_value END) AS C1_pre_investigative_3,
         COUNT(CASE WHEN event_name = 'cyclist1_question2_pre' AND param.key = 'mood_age_4' AND param.value.int_value = 2 THEN param.value.int_value END) AS C1_pre_investigative_4,
         COUNT(CASE WHEN event_name = 'cyclist1_question2_pre' AND param.key = 'mood_age_1' AND param.value.int_value = 3 THEN param.value.int_value END) AS C1_pre_confused_1,
         COUNT(CASE WHEN event_name = 'cyclist1_question2_pre' AND param.key = 'mood_age_2' AND param.value.int_value = 3 THEN param.value.int_value END) AS C1_pre_confused_2,
         COUNT(CASE WHEN event_name = 'cyclist1_question2_pre' AND param.key = 'mood_age_3' AND param.value.int_value = 3 THEN param.value.int_value END) AS C1_pre_confused_3,
         COUNT(CASE WHEN event_name = 'cyclist1_question2_pre' AND param.key = 'mood_age_4' AND param.value.int_value = 3 THEN param.value.int_value END) AS C1_pre_confused_4,
         COUNT(CASE WHEN event_name = 'cyclist1_question2_pre' AND param.key = 'mood_age_1' AND param.value.int_value = 4 THEN param.value.int_value END) AS C1_pre_fearful_1,
         COUNT(CASE WHEN event_name = 'cyclist1_question2_pre' AND param.key = 'mood_age_2' AND param.value.int_value = 4 THEN param.value.int_value END) AS C1_pre_fearful_2,
         COUNT(CASE WHEN event_name = 'cyclist1_question2_pre' AND param.key = 'mood_age_3' AND param.value.int_value = 4 THEN param.value.int_value END) AS C1_pre_fearful_3,
         COUNT(CASE WHEN event_name = 'cyclist1_question2_pre' AND param.key = 'mood_age_4' AND param.value.int_value = 4 THEN param.value.int_value END) AS C1_pre_fearful_4,
  FROM `databaseName`,
  UNNEST(event_params) AS param
  </code></pre>
  <p>Ideally the table looks like this.</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Relaxed</th>
  <th>Investigative</th>
  <th>Confused</th>
  <th>Fearful</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>mood_age_1</td>
  <td>mood_age_1</td>
  <td>mood_age_1</td>
  <td>mood_age_1</td>
  </tr>
  <tr>
  <td>mood_age_2</td>
  <td>mood_age_2</td>
  <td>mood_age_2</td>
  <td>mood_age_2</td>
  </tr>
  <tr>
  <td>mood_age_3</td>
  <td>mood_age_3</td>
  <td>mood_age_3</td>
  <td>mood_age_3</td>
  </tr>
  <tr>
  <td>mood_age_4</td>
  <td>mood_age_4</td>
  <td>mood_age_4</td>
  <td>mood_age_4</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Anybody knows how to get this sorted?</p>