开发者社区> 问答> 正文

错误代码1292-截断了错误的DOUBLE值-MySQL?mysql

我不确定这是什么错误!

#1292 - Truncated incorrect DOUBLE value: 我没有双值字段或数据!

我浪费了整整一个小时试图解决这个问题!

这是我的查询

INSERT INTO call_managment_system.contact_numbers (account_id, contact_number, contact_extension, main_number, created_by) SELECT ac.account_id, REPLACE(REPLACE(REPLACE(REPLACE(ta.phone_number, '-', ''), ' ', ''), ')', ''),'(','') AS Phone, IFNULL(ta.ext, '') AS extention, '1' AS MainNumber, '2' AS created_by FROM cvsnumbers AS ta INNER JOIN accounts AS ac ON ac.company_code = ta.company_code WHERE LENGTH(REPLACE(REPLACE(REPLACE(REPLACE(ta.phone_number, '-', ''), ' ', ''), ')', ''),'(','') ) = 10 这是我要显示结果的表的show create表

CREATE TABLE contact_numbers (
number_id int(10) unsigned NOT NULL AUTO_INCREMENT,
account_id int(10) unsigned NOT NULL DEFAULT '0',
person_id int(11) NOT NULL DEFAULT '0',
contact_number char(15) NOT NULL,
contact_extension char(10) NOT NULL DEFAULT '',
contact_type enum('Primary','Direct','Cell','Fax','Home','Reception','Office','TollFree') NOT NULL DEFAULT 'Primary',
contact_link enum('Account','PDM','Other') NOT NULL DEFAULT 'Account',
status tinyint(1) NOT NULL DEFAULT '1' COMMENT '0 = inactive, 1=active', main_number tinyint(1) NOT NULL DEFAULT '0' COMMENT '1 = main phone number',
created_on datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
created_by int(11) NOT NULL,
modified_on datetime DEFAULT NULL,
modified_by int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (number_id),
KEY account_id (account_id),
KEY person_id (person_id) ) ENGINE=InnoDB AUTO_INCREMENT=534 DEFAULT CHARSET=utf8

展开
收起
保持可爱mmm 2020-05-17 22:29:42 31033 0
1 条回答
写回答
取消 提交回答
  • 此消息表示您正在尝试比较WHEREor ON子句中的数字和字符串。在您的查询中,唯一可能发生的地方是ON ac.company_code = ta.company_code;。确保它们具有相似的声明,或使用显式CAST将数字转换为字符串。

    如果关闭strict模式,则错误应变为警告。来源:stack overflow

    2020-05-17 22:30:17
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
搭建电商项目架构连接MySQL 立即下载
搭建4层电商项目架构,实战连接MySQL 立即下载
PolarDB MySQL引擎重磅功能及产品能力盛大发布 立即下载

相关镜像