Instead of Roll up or Cube, we can use Grouping to verify the data in various level. Please have a look below on SQL query that help you to get data monthly sum, Product Sum, prod-month data sum etc.
Here I am going to show you a very good example of CHOOSE function, newly introduced in SQL Server 11.0.
Let's take an example, I have a Table having daily temperature records. Take a fake example of January, 2012. I have created a table variable with 31 records and put some rand() values for temperature column.
Now, I have to display temperature status in below manner.
Here I am going to write an query using CHOOSE Function.
Hope,
This example will help you to understand choose function.
Get rid of Case Queries: Now we have new way to get rid of lengthy case SQL. In SQL 11.0 (Formally Name: SQL 2012) we can use IIF (if and only if) instead of Case. IIF is newly introduce in SQL 11, however it was already there with VB 4.0.
So persons who have worked with any version of VB/ VB.Net, they are already aware about this function.