OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to create an array that will group each object inside that array by specific value

  • Thread starter Thread starter Monmon
  • Start date Start date
M

Monmon

Guest
I have an array of objects

enter image description here

is it possible to make a query in mysql to generate an array of 2 arrays of object that are group by group_id.

Result:

enter image description here

if not how to do this in javascript, also the group ID needs to be dynamic.?

<p>I have an array of objects</p>
<p><a href="https://i.sstatic.net/1KVXNEg3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/1KVXNEg3.png" alt="enter image description here" /></a></p>
<p>is it possible to make a query in mysql to generate an array of 2 arrays of object that are group by group_id.</p>
<p>Result:</p>
<p><a href="https://i.sstatic.net/4eTx04Lj.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4eTx04Lj.png" alt="enter image description here" /></a></p>
<p>if not how to do this in javascript, also the group ID needs to be dynamic.?</p>
 

Online statistics

Members online
0
Guests online
4
Total visitors
4
Top