Subject Re: [firebird-support] using case in order by statement in sp
Author Tetram Corp
just a miss:

you should be aware that FB will not use any index


Tetram Corp a écrit :
> hi,
>
> try this:
>
> order by S.Supp_Code,
> case when (:indexby)=0 then
> begin
> F.Farm_Name /* name index
> end
> else begin
> F.Farm_Code /* code index
> end
> end
>
> or
> order by
> case :indexby
> when 0 then Field1_0
> when 1 then Field1_1
> end,
> case :indexby
> when 0 then Field2_0
> when 1 then Field2_1
> end,
> case :indexby
> when 0 then Field3_0
> end
>