Subject | Re: Better way to write |
---|---|
Author | rogervellacott |
Post date | 2005-03-15T15:11:51Z |
Using "between 100 and 200" would avoid one of the calculations.
Alternatively it might be faster to calculate the range, rather than
the value. Something on the lines of...
where p.price between (100*ex.rate/ex_to.rate) and
(200*ex.rate/ex_to.rate)
Roger Vellacott
Passfield Data Systems
--- In firebird-support@yahoogroups.com, Nick Upson <nick@u...>
wrote:
Alternatively it might be faster to calculate the range, rather than
the value. Something on the lines of...
where p.price between (100*ex.rate/ex_to.rate) and
(200*ex.rate/ex_to.rate)
Roger Vellacott
Passfield Data Systems
--- In firebird-support@yahoogroups.com, Nick Upson <nick@u...>
wrote:
> This statementdouble
>
> select p.price, p.deviza,
> p.price*(cast(ex.rate as double precision)/cast(ex_to.rate as
> precision)) as totalheadache,
> from MyItems p
> where (total>100)and(total<200)
>
> complains about field total
>
> this one below works, but seems inefficient and has a maintenance
> easy to mistype 1 of the 3 identical statementsdouble
>
> select p.price, p.deviza,
> p.price*(cast(ex.rate as double precision)/cast(ex_to.rate as
> precision)) as totalas
> from MyItems p
> where (p.price*(cast(ex.rate as double precision)/cast(ex_to.rate
> double>100) and (p.price*(cast(ex.rate as double precision)/cast(ex_to.rate
> as double<200)
>
> --
> Nick
> -----We Solve your Computer Problems---
> Founder & Listowner of the Prolifics User Group
> Panther, Ingres, UNIX, Interbase, Firebird - Available Shortly