Connecting Tech Pros Worldwide Forums | Help | Site Map

Totals query for the last date

solar
Guest
 
Posts: n/a
#1: Nov 13 '05
I have a problem with building a totals query showing data
for the last date only.Under the last date i understand the last date
of field invoicedate.This invoice date is in the table orders.
Therefore in the column of the query i have entered :

DMax("InvoiceDate";"Orders")

I have also tried with :

DayNumber: DatePart('d';[invoicedate])



However both my approaches have led to a query that does not show the
right results.This is because i do not understand well the functions of
Date part and DMax.
Can somebody help me building the query ? My aim is to show
the quantity from all those invoices that have an invoice
with an invoice date equal to the last date of the orders
entered.


solar
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Totals query for the last date



Further to my question about the last date i have managed to rebuild
the query with the DMax function,however the query gives the total
quantity of all days and not only for the last day.
May i have some comment about my query?
SELECT Sum([order details].liters) AS SumOfLiters,
DMax("InvoiceDate","Orders") AS Expr1, customers.afid
FROM (customers INNER JOIN orders ON (customers.Customerid =
orders.customerid) AND (customers.Customerid = orders.customerid))
INNER JOIN (products INNER JOIN [order details] ON (products.Productid
= [order details].ProductID) AND (products.Productid = [order
details].ProductID)) ON orders.orderid = [order details].OrderID
WHERE (((orders.paymentid)>0))
GROUP BY DMax("InvoiceDate","Orders"), customers.afid;

pietlinden@hotmail.com
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Totals query for the last date


the DMAX stuff should be in your WHERE clause...

Closed Thread