Fusionne deux tableaux en se basant sur des conditions
Utilisez le mot-clé UNION ALL avec des conditions afin de fusionner deux tableaux en un et d'itérer sur son contenu.
Pourquoi et quand exécuter cette tâche
{
"customers": {
"Platinum": [
{
"region": "West Midlands",
"cid": 12,
"name": "E. W. Gilbert"
},
{
"region": "Greater Manchester",
"cid": 75,
"name": "John Doe"
}
],
"Gold": [
{
"region": "West Midlands",
"cid": 13,
"name": "G. K. Peatling"
},
{
"region": "Greater Manchester",
"cid": 76,
"name": "Tom Cruise"
}
]
}
}
Procédure
Résultats
[
{
"customers": [
{
"region": "West Midlands",
"cid": 12,
"name": "E. W. Gilbert",
"ranking": "Platinum"
},
{
"region": "Greater Manchester",
"cid": 75,
"name": "John Doe",
"ranking": "Platinum"
},
{
"region": "West Midlands",
"cid": 13,
"name": "G. K. Peatling",
"ranking": "Gold"
},
{
"region": "Greater Manchester",
"cid": 76,
"name": "Tom Cruise",
"ranking": "Gold"
}
]
}
]