Re: [Emerald] Invoice Next term

Dale E. Reed Jr. ( (no email) )
Wed, 09 Dec 1998 13:05:25 -0800

Greg Keys wrote:
>
> Ok..... that makes for a good answer...... would you by any chance have a
> query up you sleeve that will spot this condition? (I.E. all invoices paid
> but the dates are mismatched)

Of the top of my head try the below. The key is that maExpireDate <
LastEndDate

Select CustomerID, FirstName, LastName, maExpireDate,
LastEndDate=(Select Max(EndDate)
From Invoices i, InvoiceItems ii
Where ma.CustomerID = i.CustomerID
and i.InvoiceID = ii.InvoiceID
and ii.PaymentID > 0
and i.Type <> "VOID")