我当前的查询在 CASE WHEN 之外工作得很好:
select *, timestampdiff(DAY, from_unixtime(laststaffreplytime, '%Y-%m-%d'),
curdate()) from swtickets;
但是,当它被放置在 CASE WHEN 的 ELSE 中时,该列会生成所有空值:
SELECT *, CASE laststaffreplytime
WHEN 0 THEN 'No Response'
ELSE (timestampdiff(DAY, from_unixtime(laststaffreplytime, '%Y-%m-%d'),
curdate())) END as LastContact from swtickets;
关于为什么这个查询只返回空值的任何想法?