Skip to content
Advertisement

Convert Query Using Case Statement

I tried with CTE but results are different, I think query has some issue. Previous query is simple but I want to convert into CTE tables.

Advertisement

Answer

Here’s the issue:

is different to

So your query will yield different result.

Your cte should look like below so it will have same result on your original query.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement