Subject Unbilled orders
Author lysander_fb
Moin!

Still experimenting with ups and downs of Firebird (mostly finding
'ups')...

What is the best approach to select - for example - orders which are
not yet billed by the supplier?

I have quite a big orders-table and quite a big bills-table.
Bills-table also includes a lot of records without connection to the
orders-table.

I was trying a left outer join of both tables, and filtering for NULL
values on the right (bills) side. But I did not manage to get the
syntax correct.

Now I am doing something like this:
SELECT
orders.orderno,
orders.ordertitle
FROM
orders
WHERE
(SELECT
COUNT(bills.bill_ID)
FROM
bills
WHERE
bills.bill_reference = orders.orderno)
= 0

This works devilishly fast for me (in comparison with dBase...) but I
would like to know if this is the recommended approach or if there is
something more sneak.

Thanks for ideas,
André