title: How to loop array of objects from table column?
body: <p>Table columns :</p>
  <pre><code>id
  ---------
  details
  </code></pre>
  <p>My table column details has json object like</p>
  <pre><code>&quot;data&quot; : [ {
     &quot;name&quot; : &quot;luke&quot;,
     &quot;dob&quot; : &quot;12-10-90&quot;,
     &quot;addr&quot; : &quot;sample1&quot;,
   }, 
  {
      &quot;name&quot; : &quot;sam&quot;,
      &quot;dob&quot; : &quot;12-10-88&quot;,
      &quot;addr&quot; : &quot;sample2&quot;
     }
  ]
  </code></pre>
  <p>I want to write a query which will give me records like below :</p>
  <pre><code>| id   | name|  dob      |addr       |
  |:-----|:----|:--- ------|:----------|
  | 1    | luke|  12-10-90 |  sample1  |
  | 1    | sam |  12-10-88 |  sample2  |
  
  </code></pre>
  <p>I tried with</p>
  <pre><code>select 
      ID,
      JSON_VALUE(DETAILS, '$.data[0].name') , 
      JSON_VALUE(DETAILS, '$.data[0].dob') , 
          JSON_VALUE(DETAILS, '$.data[0].addr')
  from 
      users;
  </code></pre>
  <p>RESULT WITH COUNT :</p>
  <pre><code>id  cnt  name       dob       addr   
  --  ---  ---------  --------  -------
   1    5  luke       12-10-90  sample1
   1    5  sam        12-10-88  sample2
   2    5  awd        12-10-90  sample1
   2    5  awdawdm    12-10-88  sample2
   2    5  sevsevsev  12-10-88  sample2
  </code></pre>
  <p>EXPECTED</p>
  <pre><code>id  cnt  name       dob       addr   
  --  ---  ---------  --------  -------
   1    2  luke       12-10-90  sample1
   1    2  sam        12-10-88  sample2
   2    3  awd        12-10-90  sample1
   2    3  awdawdm    12-10-88  sample2
   2    3  sevsevsev  12-10-88  sample2
  </code></pre>