Subject Re: [firebird-support] Cross Tab queries
Author Helen Borrie
At 12:33 PM 19/12/2003 +0100, you wrote:
> > No, Fb 1.0 does not. Fb 1.5 does support CASE..WHEN.
>
>Thank you for yuor reply!
>So in FB1.5 it will be possible to use:
>
>SELECT companyname,
>SUM (CASE WHEN productname='Box' THEN 1 ELSE 0) as 'BOX',
>SUM (CASE WHEN productname='Package' THEN 1 ELSE 0) as 'Package'

This *should* work:

SELECT companyname,
SUM (CASE WHEN productname='Box' THEN 1 ELSE 0) as BOX,
SUM (CASE WHEN productname='Package' THEN 1 ELSE 0) as Package,
....
GROUP BY companyname

I haven't seen examples of CASE statements being aggregated for a crosstab,
but I don't see why not. I could test it except my test dbs aren't
accessible at the moment.

Hope Dmitry Y or Arno is watching...

In SQL, identifiers are either double-quoted or not quoted at all. Single
quotes are for string constants.

/h