Skip to content Skip to sidebar Skip to footer

Syntax Error Android Sqlite: Near "group"

Here is the exception shown by logcat window 06-08 11:25:55.532 8480-8480/example.com.shareit E/SQLiteLog: (1) near 'group': syntax error 06-08 11:25:55.542 8480-8480/example

Solution 1:

"group" This is causing problem. Try using mGroup(or anything else) instead of group.

Reason: group is a reserved word (here about group by clause) in sql.

SELECT name, sum(price) FROM YOUR_TABLE GROUPBY name

So you cannot use GROUP or group.

So your method should be:

publiclonginsertContact(int amount, String description, String date, 
int paid1, int paid2,int paid3,
int paid4, int share1, int share2,
int share3,int share4,long mGroup){

    //Put code here.

     initialValues.put(KEY_GROUP, mGroup);

    }

EDIT Also if you have KEY_GROUP = "group"; defined. Change that too to something else. One last point. Don't use date either. It is also reserved.

Best of luck.

Solution 2:

Are you using group as a column name in your customers table?, the problems seems to be the usage of 'date' and 'group' as column names, since both of them are reserved words. Try to modify the column names to date1 and group1 for example.

Post a Comment for "Syntax Error Android Sqlite: Near "group""