Help with DB query output


I need to create DB query output in a proper format for a 3rd party system which will query my Wappler APIs.

My current DB general query output is this:

My target is to make output looks like this:

output: [{sam_sip_group_number:“222”,numbers:[2548783, 587855, 554587],{sam_sip_group_number:“333”,numbers:[121212, 131313]]

Output should contain 2 arrays: one with all sam_sip_group_number, and inside this array with all number under this group named “numbers”.

I’ve already tried to play around with repeats and group by collection options - but I just can’t catch this logic.

Would be much appreciate if you could lead me with right way of achieving this.
Thank you in advance.

Community Page
Last updated: