Trying to execute a query like this and getting the numeric value not recognized error. The datatypes for the columns used are
Col1 - VARCHAR,
Col2 - VARCHAR,
Col3 - TIMESTAMP_NTZ(9)
This is my query
Select count( distinct (
case when Col1 > 100
then concat(col2,cast(col3 as string))
else 0
end))
your CASE is returning a string
and a number
which are not the same types, so if you make the 0
into a string '0'
that should work better.
A side note, you will still have a count of 1 for the all the values <= 100, which seems somewhat strange. Where-as if you used null
instead of the 0 then it will not count, and will not have a type problem.