0
Caused by: android.database.sqlite.SQLiteException: near "FROM": syntax error (code 1): , while compiling: SELECT _id, FROM TRACKS WERE _id=9

 String test = "SELECT _id, FROM TRACKS WERE _id="+"9";

    Cursor cursor = database.rawQuery(test, null);

Did not see the Point :( any help

Maybe there is a error in my Statement but it didn't work

1
  • 3
    That comma looks out of place _id, Commented Mar 30, 2016 at 20:20

2 Answers 2

2

No comma after id and WERE should be WHERE. Also consider using [rawQuery()](http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#rawQuery(java.lang.String, java.lang.String[], android.os.CancellationSignal)] with selectionArgs to avoid having to concatenate query and values as you did in +id=+9.

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

1 Comment

Ok, now I have all done - and the command seems to work - seems error is in another line :( thank you anyway to all three
2

SELECT _id, FROM TRACKS WERE _id="+"9"

'WERE' should be WHERE

1 Comment

So sad - i would like to program and I'm blind :)) thank you but it didn't Change anything - same error

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.