Subject RE: [firebird-support] Better way to write
Author Alan McDonald
> This statement
>
> select p.price, p.deviza,
> p.price*(cast(ex.rate as double precision)/cast(ex_to.rate as double
> precision)) as total
> from MyItems p
> where (total>100)and(total<200)
>
> complains about field total
>
> this one below works, but seems inefficient and has a maintenance
> headache,
> easy to mistype 1 of the 3 identical statements
>
> select p.price, p.deviza,
> p.price*(cast(ex.rate as double precision)/cast(ex_to.rate as double
> precision)) as total
> from MyItems p
> where (p.price*(cast(ex.rate as double precision)/cast(ex_to.rate as
> double>100) and (p.price*(cast(ex.rate as double
> precision)/cast(ex_to.rate
> as double<200)
>
> --
> Nick

the only way I know to avoid this is to create a view of the first statement
without the where clause, then select from the view where total> whatever
Alan