我正在尝试使用更新查询更新 2 个不同的表,如下所示
UPDATE db1.table1 a, db2.table1 b
SET b.firstname = a.firstname,
b.lastname = a.lastname,
b.address = a.address,
b.state = a.state,
b.city = a.city,
b.zip = a.zip
WHERE a.stud_id=b.stud_id AND a.firstname IS NOT NULL AND b.firstname IS NULL
AND str_to_date(a.joindate,'%m/%d/%Y') >= str_to_date('02/01/2012','%m/%d/%Y');
但是当我尝试执行此查询时,MySQL 不断抛出以下错误
Error Code: 1292. Truncated incorrect DOUBLE value: 'CROUGH0000'
虽然我在 stackoverflow 中找到了很多类似的帖子,但我找不到这个问题的确切解决方案。
需要一些帮助。提前致谢
编辑:每列的数据类型如下
b.firstname(varchar(25)) = a.firstname(varchar(52)),
b.lastname(varchar(25)) = a.lastname(varchar(35)),
b.address(varchar(40)) = a.address(varchar(50)),
b.state(char(2)) = a.state(char(2)),
b.city(varchar(25)) = a.city(varchar(25)),
b.zip(varchar(11)) = a.zip(varchar(11))