I am trying to write a select query from one single table in SQLite DB in my app where data exists.
This is the SQL.table has these columns – id(INTEGER), start_time(INTEGER), category(TEXT)
select category from tuuserid_pref where id = (select max(id) from tuuserid_pref by the way I want to bind the value shown in 1242 which I have in an Integer variable.
where start_time < '1242');
I have written selects and inserts and updates without binding parameters and they work using db.execSQL and db.rawQuery functions but just cannot figure the binding parameters out.
Any help is much appreciated.
You need to modify your select statement like so:
Then use the following
rawQuerycall:Pass your variable into the second parameter wrapped in a
String [], which should give you something like the following statement:http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html