Android - SQLiteException: next to "=": syntax error (code 1)

I am trying to write id from users table and jobname from job table using user id

String select = "SELECT jobname FROM " + TABLE_JOBS+ "where userid =" +myid;
+4
source share
2 answers
"SELECT jobname FROM " + TABLE_JOBS+ "where userid =" +myid;

You need spaces between identifiers, such as your table name and keywords, such as where:

"SELECT jobname FROM " + TABLE_JOBS+ " where userid =" +myid;
+7
source

You do not have enough space before the sentence where, so it is added directly to the table name, and you actually have no sentence where:

String select = "SELECT jobname FROM " + TABLE_JOBS+ " where userid =" +myid;
// whitespace was missing here -----------------------^
+3
source

Source: https://habr.com/ru/post/1613940/


All Articles