Subject Re: odd select case problem
Author Adam
--- In firebird-support@yahoogroups.com, Jose Antunes <ntnsjs@...>
wrote:
>
> hello all.. i dont know what to do anymore. i run firebird 1.5 here
and at my company. i use a select in my delphi application that used
to run normal but recently its simply started not to work anymore
here in my computer. strangely, it still runs normal at the company
and i haven't changed the code or the tables. i used the following
select:
>
> SELECT T1.num_cupom, T1.id_tipo_transacao, T1.data, T1.hora,
T1.id_sistema,
> T1.id_usuario, T1.id_cliente, T1.opcao, T1.desc_especial,
> T1.tt_unidades, T1.total, T1.observacao, t1.confirmada,
> T2.codigo_vip, T2.nome AS cliente, T2.email, T2.rg, T2.cpf,
T2.cnpj,
> T2.razaosoc, T2.fone_res, T2.fone_cel, T2.fone_com, T2.cidade,
> CASE t1.confirmada WHEN 0 then 'open'
> ELSE 'close' END as status
> FROM tab_propostas T1


Of course it will not work.

You are referencing many fields from a table or alias called T2, yet
this table or alias is never referenced in your from clause and there
are no joins etc. Basically you are asking Firebird to make up some
values.

Of course you may have simply not posted your entire query??

If you say that it is working on one server but not another, you need
to check the version installed. I believe CASE was only introduced in
Firebird 1.5, so if your other server is an earlier version it will
not understand the error.

Adam