Reputation: 55
I've got a table with id INTEGER PRIMARY KEY AUTOINCREMENT column and NAME VARCHAR column. And I know the value of the NAME column.
How do I retrieve id of the row that contains the value?
Upvotes: 0
Views: 498
Reputation: 83303
If you are using a ContentProvider
, you would do something along the lines of
getContentResolver().query(CONTENT_URI, null, "name_col = ?", new String[] { "name" }, null);
Upvotes: 0
Reputation: 12375
my SQLite is rusty, but something along these lines should work:
SELECT id FROM table WHERE name IS myVar
Hope this helps.
Upvotes: 2