Search breaks with multiple where criteria

QuestionsSearch breaks with multiple where criteria
Matt Lind asked 3 months ago

When I define a query to pull the data to the grid from MySql if there is more than two column search strings it breaks the grid search and filters.

For example, I have my custom query as:

SELECT * FROM Customers WHERE Country=‘US’ AND State=‘CA’ OR Country=‘US’ AND State=‘WA’

Anything more than two clauses and all search and filter functionality stops working. Any suggestions?


1 Answers
Abu answered 3 months ago

You need to use ( ) across your where conditions otherwise OR condition will always get satisfied and return recordset. Where you need () depends on your precedence. e.g.

(Country=‘US’ AND State=‘CA’) OR (Country=‘US’ AND State=‘WA’)

Your Answer

2 + 13 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.

How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!