syncano-node
syncano-node copied to clipboard
Method: whereNotBetween
// Get posts with number of votes not between 50 and 100
data.posts
.whereNotBetween('votes', 50, 100)
.list()
@23doors any idea how to build query for that?
For whereBetween this works:
whereBetween(column, min, max) {
return this.where([
[column, 'gte', min],
[column, 'lte', max]
])
}
For whereNotBetween this doesn't work:
whereNotBetween(column, min, max) {
return this.where([
[column, 'lt', min],
[column, 'gt', max]
])
}
I can make an additional query to get all records between min and max and exclude those by id.
@Idered We do not have OR in core (and we probably won't add it any time soon) so I think the only way to do it is to make two queries - where column lt min + where column gt max and join the results.
@23doors okey, thanks!