4

I am trying to log id from users table and jobname from jobs table using user id

String select = "SELECT jobname FROM " + TABLE_JOBS+ "where userid =" +myid;
2
  • In your table TABLE_JOBS 'userid' is of integer type? Commented Oct 31, 2015 at 8:28
  • white space is missing before the "where userid="+myid; instead use " where userid="+myid; Commented Oct 31, 2015 at 8:41

2 Answers 2

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

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

"SELECT jobname FROM " + TABLE_JOBS+ " where userid =" +myid;
Sign up to request clarification or add additional context in comments.

Comments

3

You're missing a whitespace before the where clause, so it gets appended directly to the table name, and you effectively don't have a where clause:

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

Comments

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.