Add/Assign value to non-null text values
I have a database which stores values (schedules) for each day of the month - such as whether a person is OFF or on VAC (vacation). So, it would look something like this:
| Name | Mon | Tue | Wed |
|---|---|---|---|
| John Smith | OFF | OFF | |
| Charlie Murphy | TRN | ||
| Ricky James | VAC | VAC | VAC |
| TOTAL | 2 | 3 | 1 |
So, I need the "TOTAL" row to add up the columns where the value is non-null. I was thinking that perhaps I could somehow assign a value of 1 to each in the columns, and then perform a sum.
Can anyone assist in a Coldfusion solution or SQL Server 2005 solution? Thanks.
