扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:佚名 来源:博客园 2007年11月11日
关键字:
SelectQueryBuilder query = new SelectQueryBuilder(); query.SelectColumns("count(*) AS Count", "ShipCity"); query.SelectFromTable("Orders"); query.GroupBy("ShipCity"); query.AddHaving("ShipCity", Comparison.NotEquals, "Amsterdam"); query.AddOrderBy("count(*)", Sorting.Descending); |
SELECT count(*) AS Count, ShipCity FROM Orders GROUP BY ShipCity HAVING (ShipCity <> 'Amsterdam') ORDER BY count(*) DESC |
SelectQueryBuilder query = new SelectQueryBuilder(); query.SelectFromTable("Orders"); // Add 'Criteria' column to level 1 query.AddWhere("CustomerID", Comparison.Equals,"VINET", 1); query.AddWhere("OrderDate", Comparison.LessThan,new DateTime(2005,1,1), 1); // Add first 'Or...' column to level 2 query.AddWhere("CustomerID", Comparison.Equals, "TOMSP", 2); query.AddWhere("OrderDate", Comparison.LessThan,new DateTime(2004,6,30), 2); // Add second 'Or...' column to level 3 query.AddWhere("CustomerID", Comparison.Equals,"TOMSP", 3); query.AddWhere("OrderDate", Comparison.GreaterThan,new DateTime(2006,1,1), 3); |
SelectQueryBuilder query = new SelectQueryBuilder(); query.SelectFromTable("Orders"); // Add 'Criteria' column to level 1 query.AddWhere("CustomerID", Comparison.Equals, "VINET", 1); query.AddWhere("OrderDate", Comparison.LessThan, new DateTime(2005,1,1), 1); // Add 'Or...' column to level 2 query.AddWhere("CustomerID", Comparison.Equals, "TOMSP", 2); // Add the date selection clause WhereClause clause =query.AddWhere("OrderDate", Comparison.LessThan, new DateTime(2004,6,30), 2); // Add a nested clause to the captured clause clause.AddClause(LogicOperator.Or, Comparison.GreaterThan, new DateTime(2006,1,1)); |
SELECT Orders.* FROM Orders WHERE ( (CustomerID = 'VINET') AND (OrderDate < '2005/01/01 12:00:00') ) OR ( (CustomerID = 'TOMSP') AND (OrderDate < '2004/06/30 12:00:00' OR OrderDate > '2006/01/01 12:00:00') ) |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者