I'm getting the Truncated incorrect INTEGER value error in MYSQL, when I execute the code below. I know the logic doesn't make much sense and that will change and I am more concert about the error. I have tried casting the whole case statement but I still get the same error message.
Here is the original statement
select
( count(case when v.SalesDate = v.SalesDate then v.Surname end) ) as x
from finaljoinalldata v
group by date(v.SalesDate)
order by date(v.SalesDate);
I have tried also
select
( count(CAST(case when v.SalesDate = v.SalesDate then v.Surname end) AS SIGNED) ) as x
from finaljoinalldata v
group by date(v.SalesDate)
order by date(v.SalesDate);
Any help will be appreciated. Thanks