title: JSON_QUERY to do a "Select Many"
body: <p>I have a JSON variable that looks like this (the real one is more complex):</p>
  <pre><code>DECLARE @myJson VARCHAR(3000) = '{
      &quot;CustomerId&quot;: &quot;123456&quot;,
      &quot;Orders&quot;: [{
              &quot;OrderId&quot;: &quot;852&quot;,
              &quot;OrderManifests&quot;: [{
                      &quot;ShippedProductId&quot;: 884,
                      &quot;ProductId&quot;: 884
                  }, {
                      &quot;ShippedProductId&quot;: 951,
                      &quot;ProductId&quot;: 2564
                  }    
              ]
          }, {
              &quot;OrderId&quot;: &quot;5681&quot;,
              &quot;OrderManifests&quot;: [{
                      &quot;ShippedProductId&quot;: 198,
                      &quot;ProductId&quot;: 4681
                  }, {
                      &quot;ShippedProductId&quot;: 8188,
                      &quot;ProductId&quot;: 8188
                  }, {
                      &quot;ShippedProductId&quot;: 144,
                      &quot;ProductId&quot;: 8487
                  }
              ]
          }
      ]
  }'
  </code></pre>
  <p>In the end, I need to know if any of the <em>ShippedProductId</em> values match their corresponding <em>ProductId</em> (in the same JSON object).</p>
  <p>I started in by trying to get a list of all the <em>OrderManifests</em>.  But while this will get me the array of orders:</p>
  <pre><code>SELECT JSON_QUERY(@myJson, '$.Orders')
  </code></pre>
  <p>I can't seem to find a way to get a list of all the <em>OrderManifests</em> across all the entries in the <em>Orders</em> array.  This does not work:</p>
  <pre><code>SELECT JSON_QUERY(@myJson, '$.Orders.OrderManifests')
  </code></pre>
  <p>Is there a way to do a Select Many kind of query to get all the <em>OrderManifests</em> in the <em>Orders</em> array?</p>