亚音速查询:生成的查询存在问题
我在亚音速查询方面遇到问题。问题是,我有一个视图,我想查询它的数据以生成类似以下 SQL 语句的内容:
select *
from myView
where (col1 like '%a%' or col2 like '%a%' or col3 like '%a%')
and col4 = 1 and col5 = 2
但是提交到数据库的查询是这样的:
select *
from myView
where col1 like '%a%' or col2 like '%a%' or col3 like '%a%'
and col4 = 1 and col5 = 2
有没有办法执行类似于第一个查询的操作?
请注意,我正在使用 .net 2.0 和 subsonic 2.2
提前谢谢您。
即便如此,亚音速规则!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要使用约束表达式< /a>:
WhereExpression
、AndExpression
、OrExpression
、EndExpression
。另请参阅:使用嵌套Where/And/Or。
You need to use the Constraint Expressions:
WhereExpression
,AndExpression
,OrExpression
,EndExpression
.Also see: Using Nested Where/And/Or.
如果您发布当前的代码,也许我能够给出更具体的答案,但基本上您必须启动
WhereExpression
。例如这样的代码:
给出如下查询:
If you post your current code maybe I will be able to give more specific answer but basically you have to start
WhereExpression
.For example code like this:
Gives query like: