如何在Mysql中执行以下的语句,
update cale set hvmic=hvi.hvmic
from hvi
where cale.bbarcode=hvi.clot and cale.bbarcode like '%Aod394%'
执行时报如下错
Error Code : 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from hvi
where cale.bbarcode=hvi.clot and cale.bbarcode like '%Aod394%' ' at line 2
(0 ms taken)
请大家帮忙,谢谢
update cale set hvmic=hvi.hvmic
from hvi
where cale.bbarcode=hvi.clot and cale.bbarcode like '%Aod394%'
执行时报如下错
Error Code : 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from hvi
where cale.bbarcode=hvi.clot and cale.bbarcode like '%Aod394%' ' at line 2
(0 ms taken)
请大家帮忙,谢谢
select hvmic from hvi
where cale.bbarcode=hvi.clot and cale.bbarcode like '%Aod394%' limit 1
)
发现Mysql这一点,不知对不对,
更新时,如两表数据相同,会不更新。
只有不同时才会更新。这点与Sql2000不同
如果更新的前后的数据是一样的,则 mysql_affected_rows() 返回 0;如
update tb set x='aa' where x='aa';虽然库中存在 x='aa' 的记录,但 MySQL 不必对数据进行更改,所以 mysql_affected_rows() 返回 0.