I am trying to do a search function in android that will allow the user search with different filters. I am able to create a simple select
statement with multiple where
clauses. My issue arises when the user doesnt use the filter options, is there a way to continue the select statement but use blank values in the where
clause?
For example, the user will want to search for all the cars and add a filter looking for specific green cars made in the year 2011.
"Select * from cars where colour = 'green' AND year = 2011"
Example where the user searches without filters for all cars
"Select * from cars where colour = '' AND year = "
I dont want to have to use two statements I would just like to use the one and have blanks in the where
clause is nothing is selected in the filter, is this possible?
Aucun commentaire:
Enregistrer un commentaire