Subject Re: Possible to write this in a way that indices will be used
Author Doru Ilasi
Hi Maya,
If you are using Firebird 2+ Testing DISTINCTness will be a nice way
to go :
http://www.firebirdsql.org/manual/nullguide-langelem.html
Doru

>
> Hi,
>
> I have a query written as follows:
>
> select blah..,
> from MyTable D
> where ((D.SuplCde = :ISupplierCode) or (:ISupplierCode is null))
> and ((D.WrhseCde = :IWarehouseCode) or (:IWarehouseCode is null))
> and ((D.StkCde = :IStockCode) or (:IStockCode is null))
> and ((D.IsActve = 'Y') or (:IIncludeInactive = 'Y'))
>
> Is there any elegant way that I can rewrite this so that it will make
> use of indexes, but without me having repeat vast volumes of code over
> and over?
>
> Thanks
> Maya
>