我有两个具有相同字段的不同选项卡,例如:
host.enabled, service.enabled.
我如何从 1 更新语句更新他的?
我试过了:
UPDATE hosts AS h, services AS s SET h.enabled=0, s.enabled=0
WHERE
ctid IN (
SELECT hst.ctid FROM hosts hst LEFT JOIN services srv ON hst.host_id = srv.host_id
WHERE hst.instance_id=1
);
在 mysql 语法上,此查询的工作方式如下:
UPDATE hosts LEFT JOIN services ON hosts.host_id=services.host_id SET hosts.enabled=0, services.enabled=0 WHERE hosts.instance_id=1