How to give names to group sets in SQL

You have a group set query in SQL that you are using to give sum total of certain numbers. The problem is where the row calculates the sum total, the cell values in the corresponding colums say ‘NULL’. How to change ‘NULL’ to something more meaninful, that is ‘Total’, ‘Sum’, ‘Sales in United States’, etc

It is really easy. Use ISNULL() function.

This query is standard query that will give you No of Leaves by each employee in all months. Now we are also interested in total leave in the year, for that we will use group sets

The problem here is the last column will give us the required number of leav1es in the year but it would say what it is in the EmployeeID column. In this case we know that it is total no of leaves in an year by that employee, so lets call it ‘Total’. We will modify the query as

Leave a Reply

Your email address will not be published. Required fields are marked *