SQL Server, the UNSUM function
Hi guys,
Are you ready for the first post of April?
Today we will talk about a new function that permit to reverse what the SUM function does.
I will do a quick post just to give to you an example!
The Unsum function
Let's start this example from the SUM function.
Suppose having a simple table with a column of type integer called value
SELECT * FROM TAB_EXAMPLE
Now we will use the SUM function to sum the values of the "value" colum.
SELECT SUM(Value) AS TOTVAL INTO TOT_EXAMPLE * FROM TAB_EXAMPLE
We will obtain a new table called TOT_EXAMPLE with one row and a total of 6.
So, type this command:
SELECT UNSUM(TOTVAL) FROM TAB_HEADER
Now, if you execute this statements will have back your single values!!! ooohhhh!!!!
Wooow, Cool very very cool!!!
If you get an error or do you need more infos you can take a look to this page
That's all for today mates and beware of April fools!!! |
|
Support my blog
Previous post: SQL Server, the bitmap operator clearly explained
Good one!
ReplyDeleteThank you Kannada!!!
Delete