Zososql - Friday, January 20, 2017 4:06 PM
The above function will always return NULL. When stat.abbrev = 'A', then stats.abbrev cannot = 'B', so the second CASE expression will return the (unspecified) default value of NULL. When stats.abbrev = 'B' then stats.abbrev cannot = 'A', so the first CASE expression will return the (unspecified) default value of NULL. (Both will return NULL when stats.abbrev is neither 'A' nor 'B'.)
When troubleshooting complex expressions like this, you should always take them apart to make sure that you are getting the values that you expect for subcomponents of those expressions.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA