MySQL中这句sql语句有问题吗?为什么总报错

UPDATE zqbp_contract SET zqbp_contract.yingshou_money = zqbp_con_m.yingshou_money WHERE zqbp_contract.contract_id = zqbp_con_m.con_id

报错:

[Err] 1054 - Unknown column 'zqbp_con_m.con_id' in 'where clause'

表结构:

zqbp_con_m表中有con_id字段, 截图发不上来


扬帆大鱼
浏览 556回答 3
3回答

慕哥9229398

UPDATE zqbp_contract,zqbp_con_m SET zqbp_contract.yingshou_money = zqbp_con_m.yingshou_money WHERE zqbp_contract.contract_id = zqbp_con_m.con_id

慕标5832272

update 语句中 update后面的,就好比select中的from,你用到的表都要加入的

紫衣仙女

UPDATE zqbp_contract SET zqbp_contract.yingshou_money = (SELECT zqbp_con_m.yingshou_money FROM zqbp_con_m WHERE zqbp_contract.contract_id = zqbp_con_m.con_id)
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java