You are here: Re: Crosstab. 2 totals ? « MsSQL Server « IT news, forums, messages
Re: Crosstab. 2 totals ?

Posted by Erland Sommarskog on 12/29/06 22:34

Jim Andersen (jba020@politiSLET.dk.invalid) writes:
> Am using robvolks crosstab-procedure to generate a crosstab query.
>
> I get this result:
> Total A B C
> juli 455 1 107 347
> okt 83 1 9 73
> aug 612 1 113 498
> juni 451 1 108 342
>
> So I get a total for each month. But I would also like a total of each
> letter
> Total A B C
> juli 455 1 107 347
> okt 83 1 9 73
> aug 612 1 113 498
> juni 451 1 108 342
> Total 1601 4 337 1260
>
> Is that possible?

You would use INSERT EXEC to capture the result from the crosstab
procedure into a temp table, and then compute a total row from the
data in it.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this 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

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