Sandip Armal Patil
Sandip Armal Patil

Reputation: 5905

how to match string value with database column?

i have one table "TABLE_SUBJECT" And i pass "subject name" to DBHelper.java.
Then i need to compare subject name with Table Column "COLUMN_SUB_NAME" and return id of
That subject. i don't understand how to do this.please anybody provide me query
Which compare name and return column_id.
Any help s appreciated.
Thanks in advance.

Upvotes: 0

Views: 1184

Answers (2)

Nishant
Nishant

Reputation: 32222

db.rawQuery("select column_id from TABLE_SUBJECT where COLUMN_SUB_NAME='"+ subjectName +"'");

Upvotes: 1

Nitin Sharma
Nitin Sharma

Reputation: 33

Select column_id from your_table_name WHERE COLUMN_SUB_NAME='your_subject name'; that's the query You should try to get column_id related to that subject. for that you should use db.rawQuery("Select column_id from your table_name WHERE COLUMN_SUB_NAME='your_subject name';");

Upvotes: 1

Related Questions