3

I have a JSON object like this (showing just one element, I got hundreds and each element belongs to many different regions):

let obj = [{
    "id": 1
    "name": "Name",
    "month": 1,
    "year": 2017,
    "regions":
    [
        {"id": 1, "name": "Europe"},
        {"id": 2, "name": "Asia"},
        {"id": 3, "name": "America"},
    ]
}]

And I'd need to query the object with alaSQL doing somthing similar to this:

let query = 'SELECT * FROM ? WHERE regions IN (1,3)'; let result = alasql(query,obj);

Is that possible?

I'm stuck with this because before, my regions field was just a single region, but now is many, and that has changed all in my code...

Thank you in advance.

J0sh
  • 51
  • 1
  • 3

0 Answers0