我正在尝试将记录插入表中,但我收到以下错误。
Mysql Error Code : 1292 Incorrect datetime value : ''
Mysql代码snip-let如下
INSERT INTO tbl_dashboard (avg_response) SELECT cast(ifnull(floor(avg(5 * (DATEDIFF(substring(im.inq_managerreply,-10), im.inq_managerdate) DIV 7) + MID('0123444401233334012222340111123400001234000123440', 7 * WEEKDAY(im.inq_managerdate) + WEEKDAY(substring(im.inq_managerreply,-10)) + 1, 1))),'not_applicable')AS CHAR(45)) 'average_response_time_in_working_days' FROM inq_manager im
执行select语句时没有错误,它给出了不包括周末的平均响应时间,但是当我尝试将上面的内容插入到我的表中时,给出了错误。 tbl_dashboard的数据类型是avg_response char(45)
我怎样才能克服这一点。请帮忙
答案 0 :(得分:0)
我不确定这是否重要,但值得一试。如果它没有帮助,我会删除它,但也许
INSERT INTO tbl_dashboard (avg_response) VALUES
(SELECT cast(ifnull(floor(avg(5 * (DATEDIFF(substring(im.inq_managerreply,-10), im.inq_managerdate) DIV 7)
+ MID('0123444401233334012222340111123400001234000123440',
7 * WEEKDAY(im.inq_managerdate) + WEEKDAY(substring(im.inq_managerreply,-10)) + 1, 1))),'not_applicable')AS CHAR(45)) 'average_response_time_in_working_days'
FROM inq_manager im)