I\'m new to Android Room. I want to read from a table and also read from a related table. The relationship is pretty common. One table defines instances. The other table defines
Instead of using *
to collect all the fields, you need to specifically provide column names because id is found in both tables hence causing the error. Change your query to something like:
select animal.id AS 'ID', animal.columnA, animal.columnB,
animal_type.columnA, animal_type.columnB from animal
join animal_type on (animal.id = animal_type.id)
You dont need to fetch IDs from both tables since they will be same, so one is enough. However, replace coulmnA, columnB, etc. with the valid column names you want to fetch.