Bill-
You need to read SQL Queries for Mere Mortals! 😃 Use a HAVING clause to filter aggregates.
From Chapter 14:
"List for each customer and order date the customer's full name and the total cost of
items ordered that is greater than $1,000."
SELECT Customers.CustFirstName || ' ' ||
Customers.CustLastName AS CustFullName,
Orders.OrderDate,
SUM(Order_Details.QuotedPrice *
Order_Details.QuantityOrdered) AS TotalCost
FROM (Customers
INNER JOIN Orders
ON Customers.CustomerID = Orders.CustomerID)
INNER JOIN Order_Details
ON Orders.OrderNumber =
Order_Details.OrderNumber
GROUP BY Customers.CustFirstName,
Customers.CustLastName, Orders.OrderDate
HAVING SUM(Order_Details.QuotedPrice *
Order_Details.QuantityOrdered) > 1000;
Note that the HAVING clause further filters the result based on an aggregate. (ANSI SQL Syntax)
John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
(Paris, France)
On Mar 23, 2017, at 8:22 PM, 'Bill Mosca' wrmosca@comcast.net [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
__._,_.___
Posted by: John Viescas <johnv@msn.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (14) |
Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.
.
__,_._,___
Tidak ada komentar:
Posting Komentar