My question is about how to make searching query with two option. for example search by name and by keyword with sqlite database in android. can i make two tables for name and keyword or just one table?
3
-
Can you Please provide for which tables you want to make queries and what you want to search ?Chintak Patel– Chintak Patel2018-03-19 06:03:00 +00:00Commented Mar 19, 2018 at 6:03
-
You need to check this example : androidhive.info/2013/09/…Adil– Adil2018-03-19 07:00:53 +00:00Commented Mar 19, 2018 at 7:00
-
in my application i've made two tables.. one tbl_books and the others tbl_title_book and in searching queries i have two option for search.. 1.search by title book and 2.search by keywordGerald Wenas– Gerald Wenas2018-03-19 07:01:59 +00:00Commented Mar 19, 2018 at 7:01
Add a comment
|
2 Answers
Something like this should work:
Cursor cusror = db.rawQuery("SELECT * FROM " + TABLE_A + " WHERE " + column_1_id + " = " + col_1_value + " AND " + column_2_id + " = " + col_2_value);
In your case, one table should be enough with name and keyword as column. Modify above query as required, like below.
column_1_id -> name
column_2_id -> keyword
1 Comment
Gerald Wenas
what is the function of col_1_value??