I think the error is pretty clear - the types of the two columns that can be used by the CASE statement are incompatible.
Why do you think that trying to use values ββfrom two columns of different types will not cause problems? You can create a new column in the result set, but it must still be of type and must match all potential values.
In many cases, in many cases it is possible to conclude about the type, but this is risky and may not necessarily be the choice you want to make, so itβs better to make it make a decision. You will need to change the type of one or the other column in the CASE statement.
source share