Reply to Re: Crosstab. 2 totals ?

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация