Subject | Re: Summary SQL question |
---|---|
Author | diwic2 |
Post date | 2005-03-04T16:43:59Z |
> SELECTThanks a lot for your help!
> uskid,
> COUNT(CASE WHEN fm=2 THEN 1 END),
> COUNT(CASE WHEN fm=3 THEN 1 END),
> COUNT(CASE WHEN fm=4 THEN 1 END),
> COUNT(CASE WHEN fm2=2 THEN 1 END),
> COUNT(CASE WHEN fm2=3 THEN 1 END),
> COUNT(CASE WHEN fm2=4 THEN 1 END)
> FROM T
> GROUP BY uskid;
>
> (B should be faster, since it requires only one pass)
>
// David