Subject RE: [firebird-support] Way to avoid many subselects
Author Leyne, Sean
Alexandre,

> select
> *
> from
> Customers cus join
> Invoices Inv on (inv.customer_id = cus.customer_id)
> where
> not exists (select 1 from Invoices where Invoices.Customer_ID =
> cus.CustomerID and Invoices.Invoice_ID > inv.Invoice_ID)

While this will get only 1 invoice, depending on way that the Invoice ID
is stored/indexed, I don't believe that it guarantees getting the first
invoice.


Sean