Reputation: 3232
I have this dataset:
[
{
"date": "2020-06-07",
"data": {
"publish": true,
"publish:title": "Hello world from tempo!"
}
},
{
"date": "2020-06-07",
"data": null
},
{
"date": "2020-06-07",
"data": null
},
{
"date": "2020-06-07",
"data": {
"sleep:start": 9.5,
"sleep:duration": 10
}
},
{
"date": "2020-06-06",
"data": null
},
{
"date": "2020-06-06",
"data": null
}
]
I want to select the date and data["sleep:start"] values for each row using Alasql. The documentation suggests using obj->property->subproperty
for that purpose, so my Alasql query should look a bit like this:
SELECT date, data->sleep:start FROM ? ORDER BY date DESC LIMIT 6
Unfortunately, this doesn't work, and quoting sleep:start
doesn't either. Is there a way to do what I'm looking for using Alasql?
Upvotes: 0
Views: 591
Reputation: 3232
Nevermind, it works with this: SELECT date, data->[sleep:duration] FROM ? ORDER BY date DESC LIMIT 6
ref https://github.com/agershun/alasql/issues/1201#issuecomment-639171925
Upvotes: 0