How to get PRIMARY KEY from the database using the value of another column? (Android, SQLite)

advertisements

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?


my SQLite is rusty, but something along these lines should work:

SELECT id FROM table WHERE name IS myVar

Hope this helps.