-2

我想用另一个表中的值更新一个表,但是这些表没有直接链接,所以我必须先通过另一个表。

 UPDATE properties 
 SET  
 properties.method = p_payment.method,
 properties.bank = p_payment.bank, 
 properties.bank_account_nr = p_payment.bank_account_nr, 
 properties.payment_note = p_payment.notes,
 properties.insurance_policy = p_payment.insurance_policy 
 FROM properties, leads, p_payment 
 WHERE properties.owner = leads.id_lead
 AND leads.payment_id = p_payment.payment_id;

我收到以下错误:

1064 - 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在第 8 行的“FROM properties,leads,p_payment WHERE properties.owner = Leads.id_lead AND l”附近使用正确的语法

谁能帮我吗?提前致谢。

4

1 回答 1

0

您正在UPDATE执行SQL Server.

这里的MySQL版本UPDATE

UPDATE  properties 
        INNER JOIN leads 
            ON properties.owner = leads.id_lead 
        INNER JOIN p_payment  
            ON leads.payment_id = p_payment.payment_id
SET     properties.method = p_payment.method,
        properties.bank = p_payment.bank, 
        properties.bank_account_nr = p_payment.bank_account_nr, 
        properties.payment_note = p_payment.notes,
        properties.insurance_policy = p_payment.insurance_policy 
于 2013-05-01T09:08:07.603 回答