title: Querying repeated key value fields in BigQuery
body: <p><s>maybe i don't get the obvious but i do not get the right query for this.</p>
  
  <p>I have multiple key value pairs (repeated data) per data row, for example:
  {"row1":"data1","row2":"data2","row3":{"key1":"value1","key2":"value2"},"row4":{"key1A":"value1A","key2A":"value2A"}}</p>
  
  <p>I try to get the "value1" for all records where in row3 "key1" is set. The same combined with row4, so if key2A is set, get me the corresponding value.</p>
  
  <p>I hope i described my problem properly.</s></p>
  
  <p>EDIT:
  For better understanding, this is an example schema of one data-row:</p>
  
  <p><code>{
      "exrow":"Example Data",
      "date":"2017-08-07",
      "hi": [
          "cd":[
              {"index":1,"value":"car"},
              {"index":2,"value":"boat"},
              {"index":3,"value":"green"},
              {"index":4,"value":"blue"}
          ],
          [...]
      ],
      [...]
  }</code></p>
  
  <p>thereby <code>'hi'</code> and <code>'cd'</code> is <code>RECORD, REPEATED</code>.</p>
  
  <p>So what i try to get is the following result row:
  <code>Example Data | 2017-08-07 | boat | blue</code></p>
  
  <p>The query - just for understanding - would be:</p>
  
  <p><code>SELECT
      exrow,
      date,
      (SELECT hi.cd.value WHERE hi.cd.index=2),
      (SELECT hi.cd.value WHERE hi.cd.index=4)
  FROM
      table</code></p>
  
  <p>So i'm trying to query two repeated (nested?) data rows with an corresponding condition.</p>
  
  <p>I hope i explained it better now.</p>