dimanche 11 octobre 2015

listview populating using cursor

Hello I am new to android programing and I have problem with cursor and list views... I manage to populate my list view with data from db using cursor adapter, and everything works just fine when I use query to select data from one table, but I add query whose task is to reed from two tables and to sum some data, but when I use that query and when I run project, androidStudio trows an exception :

java.lang.IllegalArgumentException: column '_id' does not exist

And I do not know what is wrong because when I execute the same Query in DB Browser for SQLite everything works fine...

so my query is :

select l_d.Date, sum_l, sum_km
from
(select *, sum(Liters) as sum_l from `table_liters` group by Date) as l_d,                            
(select *, sum(km) as sum_km from `table_distance` group by Date) as k_d
where l_d.Date = k_d.Date

Aucun commentaire:

Enregistrer un commentaire