Thanks for the replies, sorry if I did not make it clear but I only want
to
retreive all orders for a customer if the sum value of that customer
orders
is > 0.
e.g. if order table has 15 orders in total for the desired period:
Cust 123 has 1 order with Order_Cost 10.00, and 9 Orders with Order_Cost =
0
Cust 456 has 5 orders all with Order_Cost = 0
I would want returned the 10 orders for Cust 123 and nothing retutned for
Cust 456. The end use of this table is to print monthly customer invoices
detaling all orders placed in the month and I need to show all orders
placed
bu the customer even if the order had no cost value. What I don't want to
do
is to print invoices when there is no value to the invoice ie print an
invoice for Cust. 456. I guess at some point I need to sum the value of
Order_Cost but not quite sure.
Michel Walsh said:
I was more thinking about:
SELECT *
FROM orders
WHERE orderDate >= [start date]
AND orderDate <= [end date]
ORDER BY customer, orderNumber
where the order by is just for esthetic.
Vanderghast, Access MVP
On Jun 18, 7:06 am, "Michel Walsh"
It seems you only need a standard select query, with a criteria on the
(shipping? ) date:
BETWEEN ["enter starting date for the interval:"] AND ["enter
ending
date
for the interval:"]
You can ask to SORT the customers, to 'regroup' them in one block, in
the
output.
Hoping it may help,
Vanderghast, Access MVP
I have a customer orders table (Orders) which contains orders with
and
without cost (Orders.Order_Cost).
I need a query to achieve the following logic:
Select all orders for a customer between start date and end
date(including
those with no value) only if the customer has a least one order in
that
period with value.
Repeat this for all customers.
Do I need to use a subquery? if so any help on query format would be
much
appreciated. Thanks- Hide quoted text -
- Show quoted text -
This query would list all orders for each customer, regardless of when
placed, if the customer placed any orders within the date range.
Select A.*
from Orders as A
where exists
( Select 'true'
from Orders
where CustomerID = A.CustomerID
and OrderDate >= [start date]
and OrderDate <= [end date] )
The statement of problem is ambiguous about whether to select all
orders or orders only those within the date range.