Reputation: 1363
let part = self.parts.filter(self.deleteStatus == 0).order(self.id.asc)
Above is the query I run to get all the records from local database. Now I want to add more filters like id==5
or name='product'
in the filter. But the filter in sqlite.swift doesn't allow more than one expression in filter. How can I add more or filters in the filter method?
Upvotes: 4
Views: 1216
Reputation: 148
Filters can be chained with &&
(SQLite AND) and ||
(SQLite OR).
self.filter(deleteStatus == 0 && id == 5 && name == "product")
Upvotes: 4
Reputation: 981
The filter in Sqlite.swift does allow more than one expression; you just chain them together like this:
users.filter(id == 1 %% location == "Office" %% supervisor == "John")
Upvotes: -2