I have a Table which stores all Invoice Header Info which is called arhead. there is 2 columns
i need to query.
duedate and invoiceopen to get the the folowing.
Idealy i would like to have the query to return the folowing with a single query:
Timeframe Open Amount Max Amount Nbr of Invoices Avg Days Past due
i would like to have the result summaries by not due yet, 1 - 30 Days, 31- 60, 61 - 90 Days
and finaly all above 90 Days
right now i a doing th wth single querys like the one below but i dont know how i can get the AVG Days Past Due
SELECT SUM(invoiceopen) AS SumOpen, MAX(invoiceopen) AS MaxOpen,COUNT(*) AS CountOpen
WHERE (invoiceopen > 0) AND (duedate + 30 <= GETDATE())