Mordag Mordag - 28 days ago 6
SQL Question

Android Room - IN conditon

I am trying to implement a Room query which gets a list of integers that Room can use to return a list of entries based on that. Has anyone found a solution for that?

In the direction of that:

@Query("SELECT * FROM article_entries WHERE id IN :itemIds")
fun loadAll(itemIds : List<Int>): LiveData<List<Article>>


Thanks. :)

Answer Source

Replace:

@Query("SELECT * FROM article_entries WHERE id IN :itemIds")

with:

@Query("SELECT * FROM article_entries WHERE id IN (:itemIds)")