在运行下面的查询时,我不断收到警告:
警告| 1292 |截断不正确的DOUBLE值:'已解决的日期'。
我正在尝试仅提取日期为str_customvalue
的字符串。这就是我做DATE(DATE(str_customvalue)) is not null
的原因。
Select
case str_category
when
('Resolved Date'
and (status = 'Closed')
and (DATE(str_customvalue) is not null)
)
then
cast(str_customvalue as datetime)
else cast(str_diff_date` as datetime)
end AS last_diff_date
From table
有没有办法删除此警告?查询工作正常,但为了让我的脚本通过QA,我需要删除此警告。
答案 0 :(得分:0)
我通过使用IF()语句解决了这个问题:
Select
IF ( str_category = 'Resolved Date' and
and (status = 'Closed')
and (DATE(str_customvalue) is not null,
cast(str_customvalue as datetime),
cast(str_diff_date` as datetime))
AS last_diff_date
From table