Subject | Unbilled orders |
---|---|
Author | lysander_fb |
Post date | 2005-06-15T09:34:15Z |
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é
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é