I am working to try to collect all data belonging to a particular category into a Json structure or set.
for Example
| ID | Status | Dim | 
|---|---|---|
| A | P | 5 | 
| B | Q | 10 | 
| C | R | 15 | 
| D | S | 5 | 
| A | T | 6 | 
| C | U | 9 | 
| D | V | 20 | 
| E | W | 100 | 
| A | X | 6 | 
| F | Y | 69 | 
Output should be:
| ID | Collect | Max | Instances | 
|---|---|---|---|
| A | {P:5,T:6,X:6} | 
6 | 3 | 
| B | {Q:10} | 
10 | 1 | 
| C | {R:15,U:9} | 
15 | 2 | 
| D | {S:5,V:20} | 
20 | 2 | 
| E | {W:100} | 
100 | 1 | 
| F | {Y:69} | 
69 | 1 | 
I cannot create procedures since the org has not given me the appropriate privilege.
I was looking into multiset in Informix but that is confusing-
I wrote the query to try to build the first two columns, because I can write the max and instances later
    select id,multiset(select status, dim from table i where i.id=t.id) Collect from table t where category='A'
This gave me 3 rows all containing the same value
| id | collect | 
|---|---|
| A | [IfxStruct. Type: row ( item_nbr int  not null) , IfxStruct. Type: row ( item_nbr int  not null) , IfxStruct. Type: row ( item_nbr int  not null) ] | 
| A | [IfxStruct. Type: row ( item_nbr int  not null) , IfxStruct. Type: row ( item_nbr int  not null) , IfxStruct. Type: row ( item_nbr int  not null) ] | 
| A | [IfxStruct. Type: row ( item_nbr int  not null) , IfxStruct. Type: row ( item_nbr int  not null) , IfxStruct. Type: row ( item_nbr int  not null) ] | 
I would settle for a comma seperated list of values For example
| id | collect | 
|---|---|
| A | "P:5","T:6","X:6" |