Subject Re: [firebird-support] Where condition by column number
Author Ann Harrison
On Sat, Dec 1, 2012 at 8:09 AM, Leonardo M. Ramé <l.rame@...> wrote:

> Hi, I'm wondering if there's a way to refer columns by number in WHERE
> conditions.
>
> I need this because I'm creating a generic method to create where
> clauses for hopefully ANY query, in FreePascal


What you suggest, sir, is blasphemy. One of the major creeds of relational
theory is the separation of the logical from the physical. Codd and all
his minions will strike you down.

On the other hand, why not just use consistent aliases?

select
case
when (a.IDADICIONAL is null) then 'TITULAR'
else 'ADICIONAL'
end as col1,
c.idcliente as col2, c.apellido as col3, c.nombres as col4
from clientes c
left join adicionales a on a.IDADICIONAL = c.IDCLIENTE

>
>


[Non-text portions of this message have been removed]