| Author: Uvarajan 12 Oct 2008 | Member Level: Silver | Rating: Points: 4 |
To be precise & simpler - The Cube is a keyword used in SQL to get the sum/total of each Group and the Grand total value. This can be used along with the Group By clause.
For better understanding with an example please check in the below link.
http://databases.about.com/od/sql/l/aacuberollup.htm
|
| Author: Vivek 12 Oct 2008 | Member Level: Gold | Rating: Points: 5 |
Refer These links in Sequence of Precedence
1. http://chiragrdarji.wordpress.com/2008/09/09/group-by-cube-rollup-and-sql-server-2005/
2. http://databases.about.com/od/sql/l/aacuberollup.htm
3. http://msdn.microsoft.com/en-us/library/bb522495.aspx
Chirag explianed it with nice example, follow that to know why use cube. Why Group By is not sufficient.
As you want two level of information, Sum and individual..
|
| Author: gururajan 11 Nov 2008 | Member Level: Gold | Rating: Points: 4 |
Hi,
the CUBE operator returns a result set that has one grouping for all possible combinations of columns in the CUBE list and a grand total grouping.
also see that http://msdn.microsoft.com/en-us/library/bb522495.aspx very useful for that.
Gururajan.K
|