ANY IN clause return resultcount 0

I’m studying how to use ANY clause, There are no results returned. I’m sure there are many results in travel-sample
SELECT * FROM `travel-sample` WHERE ANY co IN country SATISFIES co=‘France’ END;
{
“requestID”: “57666f6a-4bde-4734-bb55-48bf9224e538”,
“signature”: {
"": ""
},
“results”: [
],
“status”: “success”,
“metrics”: {
“elapsedTime”: “7.833990707s”,
“executionTime”: “7.833942455s”,
“resultCount”: 0,
“resultSize”: 0
}
}

SELECT * FROM `travel-sample` WHERE ANY co IN geo SATISFIES co.lat<46 END;
{
“requestID”: “687240b6-29f8-429e-81a9-7c951558dc64”,
“signature”: {
"": ""
},
“results”: [
],
“status”: “success”,
“metrics”: {
“elapsedTime”: “7.313464624s”,
“executionTime”: “7.313419821s”,
“resultCount”: 0,
“resultSize”: 0
}
}

expression after IN needs to be array. In your example both geo, country are not arrays. Try converting to array using TOARRAY()

``````SELECT * FROM `travel-sample` WHERE ANY co IN TOARRAY(geo) SATISFIES co.lat<46 END;
SELECT * FROM `travel-sample` WHERE ANY co IN TOARRAY(country) SATISFIES co='France' END;
``````
1 Like

My statment is wrong? why it doesn’t return satisfied results ? any friends can help me ?

ANY co IN geo SATISFIES co.lat<46 END
In travel sample geo is not array it is object. when co IN geo evaluated co becomes NULL because it is not array. SATISFIES and ANY evaluates false.

Try following statement on travel sample.

``````SELECT * FROM `travel-sample`
WHERE type = "route" AND ANY v IN schedule SATISFIES v.flight LIKE 'AA%' END;``````
1 Like