存储过程 Data truncation: Incorrect date value: ‘1988‘ for column ‘date‘ at row 1

最近写存储过程报错

网上搜都是说mysql sql脚本格式不对

我这里是存储过程,我在想时间也是对的啊,时间格式,为啥

原来的

 SET updateSQL = CONCAT("INSERT INTO data_bi.bi_user_catch_partake_day_static(date, room_id, vip, user_type, fish_id, factor_type, acc_num, first_acc_num)
            SELECT date, room_id, vip, user_type, fish_id, factor_type, count(account_id), count(if(is_new_acc = 1,account_id,null))
            FROM data_bi.bi_user_catch_partake_day_active WHERE date = ", theTime, "
            GROUP BY ", groupBySbStr, "
            ON DUPLICATE KEY UPDATE acc_num = VALUES(acc_num),first_acc_num = VALUES(first_acc_num)");
            call data_tslog.execute_sql(updateSQL);

大家有没有发现

其实少了引号,这里解析为2020-08-11,引号没有解析

SET updateSQL = CONCAT("INSERT INTO data_bi.bi_user_catch_partake_day_static(date, room_id, vip, user_type, fish_id, factor_type, acc_num, first_acc_num)
            SELECT date, room_id, vip, user_type, fish_id, factor_type, count(account_id), count(if(is_new_acc = 1,account_id,null))
            FROM data_bi.bi_user_catch_partake_day_active WHERE date = '", theTime, "'
            GROUP BY ", groupBySbStr, "
            ON DUPLICATE KEY UPDATE acc_num = VALUES(acc_num),first_acc_num = VALUES(first_acc_num)");
            call data_tslog.execute_sql(updateSQL);

希望能帮到你,我的博客:idearyou.cn

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值