I tried to use the SelectQueryBuilder for the following query,but it is not coming exactly as it should be.
I want a Query String Like this
SELECT * FROM CustomerData WHERE (CustomerType = 'SPC3' OR CustomerType = 'SPC2' OR CustomerType = 'SPC5') AND Country='UK'
but what I am getting is
SELECT * FROM CustomerData WHERE ((CustomerType = 'SPC3' OR CustomerType = 'SPC3') AND (CustomerType = 'SPC2' OR CustomerType = 'SPC2') AND (CustomerType = 'SPC5' OR CustomerType = 'SPC5')) AND country='UK'
My code is:
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();
How can I add LogicOperator.Or in the statement itself ?
Thanks.