Subject Re: To JOIN or not to JOIN that is the question
Author Bhavbhuti Nathwani
Hi Svein

Thanks for your response please read inline

--- In firebird-support@yahoogroups.com, Svein Erling Tysvær <svein.erling.tysvaer@...> wrote:
>
> The main problem with your query is that it in most cases will produce the wrong result!

Yes you are correct I started getting wrong results, this was not noticable to me until I added a couple of more records to tWastedChit.

> you generally have two options, either use LEFT JOIN as Alexandre already has shown, or use

Thanks for an alternative WHERE.

>both of them), they're both pretty quick unless tBOMIssue contains a lot of records or tWastedChit.itBMRID lacks an index.

Over a period, yes, tBOMIssue will contains a lot of records but tWastedChit will be trying to play catchup with it because they are start and stop records for a batch being produced. tWastedChit.itBMRID does have an index (with a constraint) as it is the FK for tBOMIssue.iID

Thanks and regards.
Bhavbhuti