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")