0

运行下面的查询时,我不断收到警告:

警告 | 第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,我需要删除此警告。

4

1 回答 1

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
于 2013-08-15T20:47:14.393 回答