I am trying to use this query upon my Android database, but it does not return any data. Am I missing something?
SQLiteDatabase db = mDbHelper.getReadableDatabase(); String select = "Select _id, title, title_raw from search Where(title_raw like " + "'%Smith%'" + ")"; Cursor cursor = db.query(TABLE_NAME, FROM, select, null, null, null, null); startManagingCursor(cursor); return cursor;
You may try something like: SQLiteDatabase db = this. getWritableDatabase(); String selectQuery = "select sum(odometer) as odometer from tripmileagetable where date like '2012-07%'"; Cursor cursor = db. rawQuery(selectQuery, null);
android.database.sqlite.SQLiteOpenHelper. A helper class to manage database creation and version management.
This will return you the required cursor
Cursor cursor = db.query(TABLE_NAME, new String[] {"_id", "title", "title_raw"}, "title_raw like " + "'%Smith%'", null, null, null, null);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With