KevinSlater
Registered User.
- Local time
- Today, 02:12
- Joined
- Aug 5, 2005
- Messages
- 249
Hi,
I'm trying to do a query in access to show any customers that have spent £200 or less in total during 2008. We have an access database
that has records of all customers, customer branch and invoice details.
so far ive created a query that looks at the related fields, and some example data is shown below:
Customer, Customer branch, invoice date, Item price
Customer1 branch1 07/05/2008 50
Customer1 branch2 10/06/2008 100
Customer1 branch3 18/08/2008 40
Customer2 branch1 07/05/2008 400
Customer2 branch2 10/07/2008 800
Customer2 branch3 18/11/2008 600
So in the example data the querys results should show the following
Customer Money spent
Customer 1, 180
Because the item price of invoices for customer1 was under 200, but as customer2 was over 200 its not shown in the query
results.
SQL i have at present is below:
SELECT customers.Customer, Invoices.[Invoice Date], Invoices.[Item Price]
FROM customers INNER JOIN Invoices ON customers.Customer = Invoices.Customer
WHERE (((Invoices.[Invoice Date])>#12/31/2007#) AND ((Invoices.[Item Price])<200));
Ive filtered the invoice date to only show records for 2008 and made the item price field <200 but from here im not sure what needs to be done. guess i need to create a new field for money spent? and do a calculation but not sure what to do
Any advise on how to do this would be great
I'm trying to do a query in access to show any customers that have spent £200 or less in total during 2008. We have an access database
that has records of all customers, customer branch and invoice details.
so far ive created a query that looks at the related fields, and some example data is shown below:
Customer, Customer branch, invoice date, Item price
Customer1 branch1 07/05/2008 50
Customer1 branch2 10/06/2008 100
Customer1 branch3 18/08/2008 40
Customer2 branch1 07/05/2008 400
Customer2 branch2 10/07/2008 800
Customer2 branch3 18/11/2008 600
So in the example data the querys results should show the following
Customer Money spent
Customer 1, 180
Because the item price of invoices for customer1 was under 200, but as customer2 was over 200 its not shown in the query
results.
SQL i have at present is below:
SELECT customers.Customer, Invoices.[Invoice Date], Invoices.[Item Price]
FROM customers INNER JOIN Invoices ON customers.Customer = Invoices.Customer
WHERE (((Invoices.[Invoice Date])>#12/31/2007#) AND ((Invoices.[Item Price])<200));
Ive filtered the invoice date to only show records for 2008 and made the item price field <200 but from here im not sure what needs to be done. guess i need to create a new field for money spent? and do a calculation but not sure what to do
Any advise on how to do this would be great