Hi,
I seem to be stuck on this N1QL query.
consider I have this document with the key ‘fred-125’…
{
"id": "fred-125",
"type": "MD",
"primaryOrders": {
"HRRRE_mem0": {
"cycle_seconds": "{\"0\":[0,32400],\"1520553600\":[0,43200,54000,64800],\"1522281600\":[0,43200,64800,75600],\"1530576000\":[0,43200],\"1552003200\":[0,43200,64800],\"1584403200\":[0,21600,43200,64800]}",
"m_order": 439
},
"HRRRE_mem1": {
"cycle_seconds": "{\"0\":[0,32400],\"1520553600\":[0,43200,54000,64800],\"1522281600\":[0,43200,64800,75600],\"1530576000\":[0,43200],\"1552003200\":[0,43200,64800],\"1584403200\":[0,21600,43200,64800]}",
"m_order": 440
},
"HRRRE_mem2": {
"cycle_seconds": "{\"0\":[0,32400],\"1520553600\":[0,43200,54000,64800],\"1522281600\":[0,43200,64800,75600],\"1530576000\":[0,43200],\"1552003200\":[0,43200,64800],\"1584403200\":[0,21600,43200,64800]}",
"m_order": 450
},
"HRRRE_mem3": {
"cycle_seconds": "{\"0\":[0,32400],\"1520553600\":[0,43200,54000,64800],\"1522281600\":[0,43200,64800,75600],\"1530576000\":[0,43200],\"1552003200\":[0,43200,64800],\"1584403200\":[0,21600,43200,64800]}",
"m_order": 460
},
"HRRRE_mem4": {
"cycle_seconds": "{\"0\":[0,32400],\"1520553600\":[0,43200,54000,64800],\"1522281600\":[0,43200,64800,75600],\"1530576000\":[0,43200],\"1552003200\":[0,43200,64800],\"1584403200\":[0,21600,43200,64800]}",
"m_order": 470
},
"HRRRE_mem5": {
"cycle_seconds": "{\"0\":[0,32400],\"1520553600\":[0,43200,54000,64800],\"1522281600\":[0,43200,64800,75600],\"1530576000\":[0,43200],\"1552003200\":[0,43200,64800],\"1584403200\":[0,21600,43200,64800]}",
"m_order": 480
},
"HRRRE_mem6": {
"cycle_seconds": "{\"0\":[0,32400],\"1520553600\":[0,43200,54000,64800],\"1522281600\":[0,43200,64800,75600],\"1530576000\":[0,43200],\"1552003200\":[0,43200,64800],\"1584403200\":[0,21600,43200,64800]}",
"m_order": 490
},
"HRRRE_mem7": {
"cycle_seconds": "{\"0\":[0,32400],\"1520553600\":[0,43200,54000,64800],\"1522281600\":[0,43200,64800,75600],\"1530576000\":[0,43200],\"1552003200\":[0,43200,64800],\"1584403200\":[0,21600,43200,64800]}",
"m_order": 500
}
}
}
And I have a simple select for getting a key (in reality it is more complex but that doesn’t matter)…
select raw 'HRRRE_mem0' as k;
which gives me a k (‘HRRRE_mem0’)
I know I can do this…
select raw mdata.primaryOrders.HRRRE_mem0.m_order FROM mdata USE KEYS "fred-125";
[
439
]
but how could I use the simple select that returns the key k ‘HRRRE_mem0’ such that I could replace the literal ‘HRRRE_mem0’ in the above query with the subquery so that I could implement the above query dynamically?
I’ve tried implementing a variable substitution in the query many different ways but I don’t seem to understand the proper syntax.
Thanks for any help.