Subject Re: Index Help
Author Svein Erling
No Sivaraman,
you do not have to select arrangementid. Firebird just uses the index
when trying to decide which rows to return.

Just create an index on ARRANGEMENTID in one of your tables and then
use this query:

SELECT DISTINCT A.LCL_KEY
FROM AccUnit A
JOIN BATCHDTL BD ON A.ARRANGEMENTID=BD.ARRANGEMENTID
ORDER BY A.LCL_KEY

(I changed from SQL-89 until SQL-92 since some tools handle this
better than joining tables in the where clause. Besides it becomes
easier to read).

--- In ib-support@yahoogroups.com, "sivram_mail" <sivram_mail@y...>
wrote:
> Hello,
>
> In the index, that field is the second field.If we create one
> index in AccUnit table for ArrangementId, then i have to select
> Arrangementid in the selective query,then only that index will be
> used.Thatswhat you are telling.But in my case, if i select
> arrangementid in the select query, i will get different result.
> Suppose i have same Lcl_key value for two different arrangementid,
> then i will get different result..In this case what i have to do?
>
> Thanks
>
> Sivaraman