试题详情
单项选择题你工作在一个售书公司.你正在基于SQL SERVER 2005数据库创建一个报表。此报表显示本月超过销售配额的销售代表及他们的销售额 。已知,销售配额为$2,000。查询的起始日期和截至日期以变量@FromDate 和 @ToDate 传递进来。为了实现满足上述条件的报表,你应该使用下面哪一个SQL查询语句?()

A、SELECT s.AgentName,SUM(ISNULL(o.OrderTotal,0.00))AS SumOrderTotal FROM SalesAgent s JOIN OrderHeader o ON s.AgentID = o.AgentIDWHERE o.OrderDate BETWEEN @FromDate AND  @ToDate  GROUP BY  s.AgentName

B、SELECT s.AgentName,SUM(ISNULL (o.OrderTotal,0.00))AS SumOrderTotal  FROM SalesAgent s JOIN  OrderHeader o ON s.AgentID = o.AgentIDWHERE o.OrderDate BETWEEN @FromDate AND @ToDate  AND o.OrderTotal >= 2000  GROUP BY s.AgentName

C、SELECT s.AgentName, SUM(ISNULL (o.OrderTotal,0.00))AS SumOrderTotal FROM SalesAgent s JOIN OrderHeader o ON s.AgentID = o.AgentID WHERE o.OrderDate BETWEEN @FromDate AND @ToDateGROUP BY s.AgentNameHAVING SUM(o.OrderTotal) >= 2000

D、SELECT s.AgentName,SUM(ISNULL(o.OrderTotal,0.00))AS SumOrderTotal FROM SalesAgent s JOIN OrderHeader o ON s.AgentID=o.AgentIDWHERE o.ordertotal =2000 AND o.OrderDate BETWEEN @FromDate AND @ToDate GROUP BY s.AgentName HAVING  SUM(o.OrderTotal)>= 2000

  • C
  • 关注下方微信公众号,在线模考后查看

热门试题