Reputation: 5905
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
Reputation: 32222
db.rawQuery("select column_id from TABLE_SUBJECT where COLUMN_SUB_NAME='"+ subjectName +"'");
Upvotes: 1
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