I'm having this following weird issue with Sqlite query in Android 4.4.2 version devices.Thanks in advance
The table structure is as below
CREATE TABLE responsemaster (
id INTEGER PRIMARY KEY AUTOINCREMENT,
formid integer,
proposerid text,
fieldid integer,
response text,
remarks text,
listId integer,
isMarked integer
)
and the query that giving error is
SELECT id as id, formid as formid, proposerid as proposerid, MIN(fieldid) fieldid, response as response, remarks as remarks, listId as listId, isMarked as isMarked
FROM responsemaster
WHERE formid = 40066 AND proposerid = '7ca6533a-c5f0-43e2-9980-83f9ae2c7370201802230113550000'
GROUP BY fieldid
The exception i'm getting is as follows
android.database.sqlite.SQLiteException: aggregate functions are not allowed in the GROUP BY clause (code 1):,
while compiling: SELECT id as id, formid as formid, proposerid as proposerid, **MIN(CAST(fieldid AS INTEGER)) AS fieldid**, response as response, remarks as remarks, listId as listId, isMarked as isMarked FROM responsemaster WHERE formid = 40066 AND proposerid = '7ca6533a-c5f0-43e2-9980-83f9ae2c7370201802230113550000' GROUP BY fieldid
The above query will execute successfully in SQLite browser and in Greater than Android 4.4.2 version devices..Please can any one help me how i can able to fix that error?