Using JSON_TABLE to save an unorder ARRAY

36 Views Asked by At

I have the next array, I need to save in a json_table, the problem They are shown in different order for each employee For that reason I can't store using:

Depto varchar(100) path '$.plaza.nodosEstructura[1].Descripcion',

My json is:


"plaza": {
            "employee": 19769,
            "nodosEstructura": [
                {
                    "estructura": 5,
                    "descripcion": "IMI 2"
                },
                {
                    "estructura": 1,
                    "descripcion": "TKS"
                }
            ]
},
"plaza": {
            "employee": 19770,
            "nodosEstructura": [               
                {
                    "estructura": 1,
                    "descripcion": "INDUSTRIAL"
                },
         {
                    "estructura": 5,
                     "descripcion": "IMI 1"
                }
            ]
}

I need to save in a table using the next estructure:

Employee Estructura1 Estructura5
19769 TKS IMI 2
19770 INDUSTRIAL IMI 1

Could you help me please =(

Order in a json_table an unordered array

0

There are 0 best solutions below