Subject Re: [ib-support] Re: please help me with this query, TNX!!!
Author Roberto Della Pasqua
Very thanks !!!


----- Original Message -----
From: "fabiano_bonin" <fabiano@...>
To: <ib-support@yahoogroups.com>
Sent: Monday, June 09, 2003 12:07 AM
Subject: [ib-support] Re: please help me with this query, TNX!!!


> Hi, Roberto.
>
> You can do that in a single statement just with the great FB 1.5.
> In FB 1.0 you will probably need a SP.
>
> create table test1 (
> column1 integer,
> column2 integer,
> column3 integer );
>
> -> Insert some records
>
> select
> ( ( case when x.column1 = :column1 then 1 else 0 end ) +
> ( case when x.column2 = :column2 then 1 else 0 end ) +
> ( case when x.column3 = :column3 then 1 else 0 end )
> ) as column1,
> x.*
> from
> test1 x
> where
> ( x.column1 = :column1 ) or
> ( x.column2 = :column2 ) or
> ( x.column3 = :column3 )
> order by
> 1 desc
>
> -> And you have your big matching ordered first