2
String Where = "SELECT FROM peopleTable WHERE _id BETWEEN " + i1+ " AND " + i2;

Where is the mistake? LogCAT:

12-18 16:47:54.497: E/SQLiteLog(2447): (1) near "SELECT": syntax error
12-18 16:47:54.757: E/AndroidRuntime(2447): FATAL EXCEPTION: main
12-18 16:47:54.757: E/AndroidRuntime(2447): android.database.sqlite.SQLiteException: near "SELECT": syntax error (code 1): , while compiling: SELECT _id, persons_name, persons_hotness FROM peopleTable WHERE SELECT FROM peopleTable WHERE _id BETWEEN 2 AND 4
3
  • You are using SELECT inside another SELECT thats why it is giving a Syntax error not because of BETWEEN CLAUSE. Commented Dec 18, 2013 at 18:48
  • So How it could be written Please tell me in brief. @VishalKale Commented Dec 18, 2013 at 19:11
  • Look at the answer below I have already written there... Commented Dec 18, 2013 at 19:13

1 Answer 1

1

Instead of

SELECT _id,
persons_name,
persons_hotness FROM
peopleTable WHERE SELECT
FROM peopleTable WHERE
_id BETWEEN 2 AND 4 

Use this query

 SELECT _id,
persons_name,
persons_hotness FROM
peopleTable WHERE
_id BETWEEN 2 AND 4



 db.query("peopleTable",
 new String[] {_id, person_name,                person_hotness},
"WHERE _id BETWEEN 2 AND 4",        null, null, null, null);
Sign up to request clarification or add additional context in comments.

1 Comment

So How it could be written Please tell me in Programming Code. @VishalKale

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.