I'm having a problem with subsonic query. The deal is, I have a view and I want to query it's data to produce something like the following SQL statement:
select *
from myView
where (col1 like '%a%' or col2 like '%a%' or col3 like '%a%')
and col4 = 1 and col5 = 2
But instead the query that is submited to the DB is something like this:
select *
from myView
where col1 like '%a%' or col2 like '%a%' or col3 like '%a%'
and col4 = 1 and col5 = 2
Is there a way to do something like the fisrt query?
Please note I'm using .net 2.0 and subsonic 2.2
Thank you in advance.
Even do, Subsonic rules!
You need to use the Constraint Expressions:
WhereExpression
,AndExpression
,OrExpression
,EndExpression
.Also see: Using Nested Where/And/Or.