0

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.

2
  • Is your table called table? That could very likely be confusing SQLite. Commented Aug 23, 2011 at 15:09
  • @Rafe Kettler:No, it's "coord". Commented Aug 23, 2011 at 15:10

1 Answer 1

2

The syntax error comes from the fact the reserved keyword table is used after the from clause 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".

Sign up to request clarification or add additional context in comments.

1 Comment

AAAAA how i did not noticed this error? And when did i change it ! Sometimes we're making some weird things. Thank you for helping.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.