Subject Re: [firebird-support] Convert DBISAM Sql to Firebird Sql
Author Hans
Maybe along the lines like:

Select Numero
Sum(Case
when (concepto = 1) then
cast(valor as float)
else
cast(0 as float)
end) as Val1
etc, etc

----- Original Message -----
From: "Manuel Salinas" <msalinas_1999@...>
To: <firebird-support@yahoogroups.com>
Sent: Saturday, December 02, 2006 9:08 AM
Subject: [firebird-support] Convert DBISAM Sql to Firebird Sql


> Hi,
>
> Can somebody help me converting this sql to run in Firebird 1.5.3?
> This Sql statement generates a Pivot table, if "concepto" does not
> exist for a "Numero", the resulting column for that row will be 0.
>
>
> Select Numero,
> Sum(if (concepto=1 then cast(valor as float) else cast(0 as float)))
> as Val1,
> Sum(if (concepto=80 then cast(valor as float) else cast(0 as float)))
> as Val80,
> Sum(if (concepto=85 then cast(valor as float) else cast(0 as float)))
> as Val85
> From Movtos
> group by numero
>
> I was reading it could be possible using Stored Procedures... can
> somebody share with me an example?
>
> Thanks in advance.
>
>
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>