I have an SQL Fiddle here: http://sqlfiddle.com/#!18/2ab05d/69
The code runs for me in SSMS SQL 2016, but it will not run within SQL Fiddle
Any way to fix it?
Thank you,
Lindsay
It looks like a bug in http://sqlfiddle.com.
Your code runs fine on SQL Server 2016 in https://dbfiddle.uk though, so you could just switch to that one.
Demo:
id_num | religionCategory ------: | :--------------- 2520985 | Catholic 2541075 | Protestant 2934559 | Buddhist 3298125 | Protestant 3378597 | Presbyterian 3407535 | Catholic 3448905 | Presbyterian 2522034 | Protestant 2543021 | All Other 2933729 | Protestant 3450792 | Jewish 3041872 | Protestant 3210738 | Catholic 3220142 | Hindu 3570871 | Protestant 3348798 | Protestant 2343987 | Protestant 3433789 | Presbyterian