Subject | Re: [firebird-support] Cross Tab queries |
---|---|
Author | Helen Borrie |
Post date | 2003-12-19T12:21:52Z |
At 12:33 PM 19/12/2003 +0100, you wrote:
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
> > No, Fb 1.0 does not. Fb 1.5 does support CASE..WHEN.This *should* work:
>
>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'
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