I would like to search a column value by other column searching.
For example: There are 3 columns a, b, c. I am going to get the value of column c by searching column b.
How can I do that?
Do I need to use cursor
?
public String getc(String code)
{
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(TABLE_OWNER, new String[] { a , b , c }, b + "=?", new String[] { code }, null, null, null, null);
}
So, where should I put the select c?
I would do something like this
String [] valueyouwishtosearchfor = {"somevalue"}; // or get this however you like
Cursor query = cr.query(TABLE_OWNER, new String[] { c }, " where b=?",
valueyouwishtosearchfor, null);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.