I have a raw data like below then I create a flag,got the error result.
case([ECSTDAT2 < v10_RETAMT_DADAT3 && ECENDAT2 < v10_RETAMT_DADAT3, DATEDIF(ECSTDAT2, ECENDAT2, day) * ECDOSE2, 0]),it confused me .
Hi Wu Cong,
The case condition is giving 0 means the comparison and AND condition are not true. All the columns seem to be date data type. You can explicitly try to set the date format. There are 2 ways:
There are UNIXTIMEFORMAT and DATEFORMAT functions you can try to see which one leads to the correct answer.
Tip: disintegrate your condition into single steps to find out which AND condition is not giving the correct result. Hope this helps.
Take care and stay safe,
Apeksha
the right result should be 0,38,0,38. so why I got the wrong expected result .
and sometimes ,I can get the right result use case like this
is there any difference to use in case and if ??