engstevo (7/3/2013)
I have tried this but my head of it department still telling me tht i have failed this is my last chanceWrite a SQL statement from the above example tables that will return the Product Name and Quantity with the maximum quantity sold per day.
SELECT e.BuProductName,s.sum(OrderQuantity) as Sold per day
FROM dbo.Product AS e
INNER JOIN dbo.Transact AS s
ON e. productID= s. productID
Syntactically incorrect. Should read: -
SELECT e.BuProductName,
SUM(s.OrderQuantity) AS [Sold per day]
FROM dbo.Product AS e
INNER JOIN dbo.Transact AS s ON e.productID = s.productID
GROUP BY e.BuProductName;
However, that isn't the answer to your question. For that, we need readily consumable sample data and DDL. Take a look at this article (http://www.sqlservercentral.com/articles/Best+Practices/61537/)[/url] for the best way to ask a question on a technical forum.