I’m facing this problem
08-23 14:54:25.370: ERROR/AndroidRuntime(16728): Caused by: android.database.sqlite.SQLiteException: near "table": syntax error: , while compiling: SELECT DISTINCT latitude, longitude FROM table
when the compiler tries to execute this query:
String[] result_columns = new String[] {COL_LATI, COL_LONGI};
Cursor cur = db.query(true, TABLE_COORD, result_columns,null, null, null, null, null, null);
What can be the source of the problem? I’m not seeing any syntax error on that query. No?
Thanks for helping.
The syntax error comes from the fact the reserved keyword
tableis used after thefromclause of the SQL query. But in the comments you said that the table is called"coord", not"table".Check your
static final String TABLE_COORD, I think it is erroneously set to"table"instead of being set to"coord".