Having a weird issue here where a query executes just fine in Sqlite DB Browser on my desktop - results exactly as expected - but throws an exception when executing a Cursor in Android (4.4.2). I'm new to both Android and Sqlite so maybe there's a "gotcha" I haven't discovered yet.
Simple query:
select
max(_id) as '_id',
max(envid) as 'envid',
max(action) as 'action',
max(title) as 'title',
max(cast(version as INTEGER)) as 'version',
max(layout) as 'layout'
from template
where direction = 'return'
group by title
Exception:
E/AndroidRuntime(20731): Caused by: android.database.sqlite.SQLiteException: aggregate functions are not allowed in the GROUP BY clause (code 1): , while compiling: select max(_id) as '_id', max(envid) as 'envid', max(action) as 'action', max(title) as 'title', max(cast(version as INTEGER)) as 'version', max(layout) as 'layout' from template where direction = 'return' group by title
I'd expect to see that if I put an aggregate function in the group by clause...but I haven't.
Aucun commentaire:
Enregistrer un commentaire