My query doesn't work

  • Thread starter Thread starter Jeff D'Amelio
  • Start date Start date
J

Jeff D'Amelio

This is the SQL for a query I designed last year to
determine who got christmas cards from us. It looked at
total sales of each customer and chose all that were
equal to or above $100. Sort by the total sales of each
customer, in descending order. Also show the customers'
name and address. Now when I run it nothing is found. I
can't imagine what I have done to it in the interim. I
did copy it for 2003, and that doesn't work either. This
is the only way I can think of getting a quick assessment.

Thank you for your assistance in advance.

SELECT Sum(Sales.Amount) AS SumOfAmount, First
(Customers.Store) AS FirstOfStore, First
(Customers.Address1) AS FirstOfAddress1, First
(Customers.City) AS FirstOfCity, First(Customers.State)
AS FirstOfState, First(Customers.Zip) AS FirstOfZip, First
(Customers.Address2) AS FirstOfAddress2, First
(Customers.Contact) AS FirstOfContact
FROM Customers INNER JOIN Sales ON Customers.ID = Sales.ID
WHERE (((Sales.Date) Like "*/*/02"))
GROUP BY Customers.ID
HAVING (((Sum(Sales.Amount))>=100))
ORDER BY Sum(Sales.Amount) DESC;
 
Assuming Sales.Date is a Date/Time field, you might replace

WHERE (((Sales.Date) Like "*/*/02"))

with

WHERE (Year(Sales.Date) = 2003)
 
-----Original Message-----
Assuming Sales.Date is a Date/Time field, you might replace

WHERE (((Sales.Date) Like "*/*/02"))

with

WHERE (Year(Sales.Date) = 2003)




.
 
Oops!! I meant to say. Thanks that worked. All other
queries that had the same design were changed
appropriately and successfully.

I knew someone out there would have the answer.
 
What is "HAVING (((Sum(Sales.Amount))>=100))"?

Searching Help on HAVING shows 0 results.
 
Back
Top