Reputation: 195
I'm trying to build a query for Room DB that finds all items except for a specific id. Well, no luck so far. I've tried both != and <> and the id is still coning through.
Query examples:
@Query("SELECT * FROM <table name> WHERE _id!=:id AND team=:team")
@Query("SELECT * FROM <table name> WHERE _id<>:id AND team=:team")
Any help is greatly appreciated.
Upvotes: 5
Views: 7513
Reputation: 195
Okay, so both != and <> do work for creating a Query where you want to exclude something that is not equal to the parameter that you're passing in. My issue was that I was running 2 separate queries concurrently and one of them need the id passed from the other. Changed the code to run one after the other finishes and all is good now.
Thanks again!
JP
Upvotes: 11