我尝试将SelectQueryBuilder用于以下查询,但它并没有达到应有的效果。
我想要一个这样的查询字符串
SELECT * FROM CustomerData WHERE (CustomerType = 'SPC3' OR CustomerType = 'SPC2' OR CustomerType = 'SPC5') AND Country='UK'
但我得到的是
SELECT * FROM CustomerData WHERE ((CustomerType = 'SPC3' OR CustomerType = 'SPC3') AND (CustomerType = 'SPC2' OR CustomerType = 'SPC2') AND (CustomerType = 'SPC5' OR CustomerType = 'SPC5')) AND country='UK'
我的代码是:
var query = new SelectQueryBuilder();
query.SelectFromTable("CustomerData");
query.SelectAllColumns();
query.AddWhere("CustomerType", Comparison.Equals,"UK");
foreach (var selectedCustomerType in selectedCustomerList)
{
WhereClause whereClause = query.AddWhere("CustomerType", Comparison.Equals, selectedCustomerType);
whereClause.AddClause(LogicOperator.Or, Comparison.Equals, selectedCustomerType);
}
String queryStatement = query.BuildQuery();
如何在语句本身中添加 LogicOperator.Or?
谢谢。