How should I write my SQL Room Query if I only want to include visits where is_deleted = 0? (The normal … AND visits.is_deleted = 0 does not work) (Given that CustomerWithVisits has an embedded customer entity and relationship on visits)
Copy code
@Transaction
@Query("""
SELECT * FROM customers
WHERE customer_id = :id
AND is_deleted = 0
""")
fun getCustomerWithVisits(id: Long): Flow<CustomerWithVisits>
p
Phill
02/15/2021, 10:04 PM
Use JOIN visits ON customer_id = visits.customer_id WHERE is_deleted = 0
Or somethig like that anyway. Look for Joins/LeftJoins etc