SQLLite3 Queries...

Hi,

Hope someone can help with this very frustrating problem.

I have an SQLLite database with 5 columns, and 11 rows of data. I am trying to create a function that queries all the data, according to my selected criteria. This part is easy. The hard part is filtering each column individually, and getting a very narrow search result. For example, I have a list of diamonds, each diamond has a different Shape, carat, cut, color, clarity and Price (columns). I am trying to create a filter whereby a user can select different filtering criteria and the tableView list populates with the filtered results. Kind of like a filtering panel on an ecommerce website to try and narrow search results for a product.

My code logic so far is the following:

When the user taps a filtering option:

  1. Delete all rows of the tableView

  2. Add that filtering keyword to an array

  3. Loop through that array

  4. retrieve my data: ----->  for row in db:nrows( [[SELECT * FROM test WHERE ‘]]…criteria…[[’ LIKE ‘%]]…query…[[%’]]) do

  5. inserts filtered row.

Problem I am having is that this only filters a particular item one at a time. I need to keep boiling down the results to a refined set of results and I am not sure how to do this.

Any help would be greatly appreciated!

Thanks!

Hi,

SQLite3 can do multiple criteria afaik, separated by ‘AND’

I’ve used it myself.

Maybe this link is helpful.

https://www.tutorialspoint.com/sqlite/sqlite_and_or_clauses.htm

Hi,

SQLite3 can do multiple criteria afaik, separated by ‘AND’

I’ve used it myself.

Maybe this link is helpful.

https://www.tutorialspoint.com/sqlite/sqlite_and_or_clauses.htm