Almora Well-Known Member Licensed User Longtime User Feb 15, 2023 #1 hi.. I want to get values in range of numbers but no results. where am i doing wrong? thanks.. Dim cur As Cursor = Main.data.ExecQuery("SELECT * FROM day WHERE BETWEEN ID=10 AND ID=21 ") Click to expand... android.database.sqlite.SQLiteException: near "BETWEEN": syntax error (code 1): , while compiling: SELECT * FROM day WHERE BETWEEN ID=10 AND ID=21 Click to expand... what I want here is to get values in the range of 10 and 21. Including 10 and 21. Last edited: Feb 15, 2023
hi.. I want to get values in range of numbers but no results. where am i doing wrong? thanks.. Dim cur As Cursor = Main.data.ExecQuery("SELECT * FROM day WHERE BETWEEN ID=10 AND ID=21 ") Click to expand... android.database.sqlite.SQLiteException: near "BETWEEN": syntax error (code 1): , while compiling: SELECT * FROM day WHERE BETWEEN ID=10 AND ID=21 Click to expand... what I want here is to get values in the range of 10 and 21. Including 10 and 21.
Solution M M Mahares Feb 15, 2023 Almora said: after research i found the right code. Click to expand... teddybear said: where id>=10 and id <=21 Click to expand... aeric said: Yes, this should work. Click to expand... The preferred and faster way is to use BETWEEN with parameters: B4X: Dim cur As Resultset= Main.data.ExecQuery2("SELECT * FROM day WHERE ID BETWEEN ? AND ? ", Array as Int(10, 21)) (you can use cursor instead of resultset if that is what you like)
Almora said: after research i found the right code. Click to expand... teddybear said: where id>=10 and id <=21 Click to expand... aeric said: Yes, this should work. Click to expand... The preferred and faster way is to use BETWEEN with parameters: B4X: Dim cur As Resultset= Main.data.ExecQuery2("SELECT * FROM day WHERE ID BETWEEN ? AND ? ", Array as Int(10, 21)) (you can use cursor instead of resultset if that is what you like)
Almora Well-Known Member Licensed User Longtime User Feb 15, 2023 #2 after research i found the right code. Dim cur As Cursor = Main.data.ExecQuery("SELECT * FROM day WHERE ID BETWEEN 10 And 21 ") Click to expand... Upvote 0
after research i found the right code. Dim cur As Cursor = Main.data.ExecQuery("SELECT * FROM day WHERE ID BETWEEN 10 And 21 ") Click to expand...
teddybear Well-Known Member Licensed User Feb 15, 2023 #3 Almora said: after research i found the right code. Click to expand... You can specify a condition using Comparision or Logical Operators such as >, <, =, LIKE, NOT, etc, Also use where id>=10 and id <=21 Last edited: Feb 15, 2023 Upvote 0
Almora said: after research i found the right code. Click to expand... You can specify a condition using Comparision or Logical Operators such as >, <, =, LIKE, NOT, etc, Also use where id>=10 and id <=21
aeric Expert Licensed User Longtime User Feb 15, 2023 #4 Almora said: after research i found the right code. Click to expand... Yes, this should work. Upvote 0
M Mahares Expert Licensed User Longtime User Feb 15, 2023 #5 Almora said: after research i found the right code. Click to expand... teddybear said: where id>=10 and id <=21 Click to expand... aeric said: Yes, this should work. Click to expand... The preferred and faster way is to use BETWEEN with parameters: B4X: Dim cur As Resultset= Main.data.ExecQuery2("SELECT * FROM day WHERE ID BETWEEN ? AND ? ", Array as Int(10, 21)) (you can use cursor instead of resultset if that is what you like) Upvote 0 Solution
Almora said: after research i found the right code. Click to expand... teddybear said: where id>=10 and id <=21 Click to expand... aeric said: Yes, this should work. Click to expand... The preferred and faster way is to use BETWEEN with parameters: B4X: Dim cur As Resultset= Main.data.ExecQuery2("SELECT * FROM day WHERE ID BETWEEN ? AND ? ", Array as Int(10, 21)) (you can use cursor instead of resultset if that is what you like)