Which action should you take to display the same result including a grand total of products ordered?

You are a database developer on an instance of SQL Server 2008. You have a SalesOrderDetail table defined as follows:


You want to display product information for products ordered through special promotional offers. You execute the following statement:
SELECT SpecialOfferID, ProductID, SUM(OrderQty) AS Total
FROM SalesOrderDetail
GROUP BY GROUPING SETS((ProductID), (ProductID, SpecialOfferID), ())
HAVING GROUPING_ID(ProductID) = 0;
When reviewing the result set returned, you notice there are no grand totals displayed.
Which action should you take to display the same result including a grand total of products ordered?
A. Remove the empty grouping set from the GROUPING SETS clause.
B. Remove the HAVING clause from the query.
C. Modify the HAVING clause to check for a value of 1 returned by the GROUPING_ID function.
D. Remove the GROUP BY and HAVING clauses and use GROUP BY SpecialOfferID WITH ROLLUP in the GROUP BY clause.

microsoft-exams

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.