As others have mentioned - it would help if you could show us the actual error message you are getting.
I looked at your SELECT statement, and noticed that you are missing spaces between some symbols in your query - that may be what is causing the problem.
Michael
Comment on Re: Problem with case in select statement