Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Glenn Espie
Starting Member
2 Posts |
Posted - 2002-10-30 : 09:49:05
|
| Has anyone modified / attempted to modify the crosstab sp posted in this forum to produce row summaries.Is it possible?I need to produce a row average. Any pointers would be very helpful.Glenn |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-10-30 : 09:54:34
|
| The second example in the article shows a row sum and a row count:EXECUTE crosstab 'select pub_name, count(qty) as orders, sum(qty) as total from sales inner join titles on (sales.title_id=titles.title_id) right join publishers on (publishers.pub_id=titles.pub_id) group by pub_name', 'sum(qty)','type','titles'You can easily change that to an AVG() or any other aggregate function. |
 |
|
|
Glenn Espie
Starting Member
2 Posts |
Posted - 2002-10-30 : 10:17:48
|
Many thanks Glennquote: The second example in the article shows a row sum and a row count:EXECUTE crosstab 'select pub_name, count(qty) as orders, sum(qty) as total from sales inner join titles on (sales.title_id=titles.title_id) right join publishers on (publishers.pub_id=titles.pub_id) group by pub_name', 'sum(qty)','type','titles'You can easily change that to an AVG() or any other aggregate function.
|
 |
|
|
|
|
|