gpt4 book ai didi

mysql - 帮助进行sql查询

转载 作者:行者123 更新时间:2023-11-29 09:12:04 25 4
gpt4 key购买 nike

我有以下查询

select * from Properties 
join PPHL on PPHL.postcode = Properties.postcode
and PPHL.name = Properties.propertyname
and PPHL.id <> Properties.propertycode
where Properties.clientid = 1

我想使用 PPHL 表中的 id 更新此查询结果中的所有属性,有谁知道我需要执行此操作的正确 sql 吗?我在 mysql 5 上运行它。

最佳答案

set 子句位于表连接之后。请参阅MySQL documentation for UPDATE获取语​​法帮助。

UPDATE Properties 
JOIN PPHL ON PPHL.postcode = Properties.postcode
and PPHL.name = Properties.propertyname
and PPHL.id <> Properties.propertycode

SET Properties.propertycode = PPNL.id
WHERE Properties.clientid = 1

关于mysql - 帮助进行sql查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5302219/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com