Youworkforacompanythatsellsbooks.YouarecreatingareportforaSQLServer2005database.Thereportwilllistsalesrepresentativesandtheirtotalsalesforthecurrentmonth.Thereportmustincludeonlythosesalesrepresentativeswhomettheirsalesquotaforthecurrentmonth.Themonthlysalesquotais$2,000.Thedateparametersarepassedinvariablesnamed@FromDateand@ToDate.Youneedtocreatethereportsothatitmeetstheserequirements.WhichSQLqueryshouldyouuse?()
A.SELECts.AgentName,SUM(ISNULL(o.OrderTotal,0.00))ASSumOrderTotalFROM SalesAgentsJOINOrderHeaderoONs.AgentID=o.AgentIDWHEReo.OrderDateBETWEEN@FromDateAND@ToDateGROUPBYs.AgentName
B.SELECts.AgentName,SUM(ISNULL(o.OrderTotal,0.00))ASSumOrderTotalFROMSalesAgentsJOINOrderHeaderoONs.AgentID=o.AgentIDWHEReo.OrderDateBETWEEN@FromDateAND@ToDateANDo.OrderTotal>=2000GROUPBYs.AgentName
C.SELECts.AgentName,SUM(ISNULL(o.OrderTotal,0.00))ASSumOrderTotalFROMSalesAgentsJOINOrderHeaderoONs.AgentID=o.AgentIDWHEReo.OrderDateBETWEEN@FromDate AND@ToDateGROUPBYs.AgentNameHAVINgSUM(o.OrderTotal)>=2000
D.SELECts.AgentName,SUM(ISNULL(o.OrderTotal,0.00))ASSumOrderTotalFROMSalesAgentsJOINOrderHeaderoONs.AgentID=o.AgentIDWHEReo.ordertotal=2000ANDo.OrderDateBETWEEN@FromDateAND@ToDateGROUPBYs.AgentNameHAVINgSUM(o.OrderTotal)>=2000
正确答案:参考C



