|
Posted by Jim Andersen on 01/02/07 12:38
--CELKO-- wrote:
> SELECT month_name,
> COUNT(*) AS tot,
> SUM(CASE WHEN foo = 'A' THEN 1 ELSE 0 END) AS tot_a,
> SUM(CASE WHEN foo = 'B' THEN 1 ELSE 0 END) AS tot_b,
> SUM(CASE WHEN foo = 'C THEN 1 ELSE 0 END) AS tot_c
> FROM Foobar
> GROUP BY month_name
> UNION ALL
> SELECT 'All months',
> COUNT(*) AS tot
> SUM(CASE WHEN foo = 'A' THEN 1 ELSE 0 END) AS tot_a,
> SUM(CASE WHEN foo = 'B' THEN 1 ELSE 0 END) AS tot_b,
> SUM(CASE WHEN foo = 'C THEN 1 ELSE 0 END) AS tot_c
> FROM Foobar;
>
> But why not use a report writer in the front end, like you are
> supposed to?
So I don't have to hardcode my A, B and C's ?
Because I am using Visual Studio .NET and that leaves me with Crystal
Reports (yuckk, hark, spit) as a reporting tool.
I think I will try Erlands suggestion.
/jim
[Back to original message]
|