Subject Re: [firebird-support] Cross Tab queries
Author Helen Borrie
At 11:25 AM 19/12/2003 +0100, you wrote:
>Hi to all,
>sorry for the repost, but nobody answers the first post.. perhaps it's not
>possible to do it (cross tab queries) but i would like to know directly
>from the gurus...
>Here it is the original post:
>Hi to all,
>i'm trying to build a cross tab query in Firebird 1.0 but i'm not able to
>do it.
>I want to use something similar to:
>SELECT companyname,
>SUM (if productname='Box' then 1 else 0) as "BOX",
>SUM (if productname='Package' then 1 else 0) as "Package"
>GROUP BY companyname
>but I think that FB 1.0 doesn't support if-then structure nor CASE-WHEN.

No, Fb 1.0 does not. Fb 1.5 does support CASE..WHEN.

>Any idea?

Use a selectable stored procedure or change to 1.5. :-)

btw, Firebird does not force you to use double-quotes when assigning
run-time field identifiers.