使用内部联接更新表列

时间:2014-02-13 05:17:20

标签: mysql sql

UPDATE micro_finance_loans AS 'ML' SET ML.Loan_status=11 
INNER JOIN micro_finance_customers AS 'MC' on MC.Customer_Id=ML.Customer_Id
WHERE ML.loan_status=10 AND MC.Number='4410188992243'

有人可以告诉我这个查询中的错误,错误如下:

  

您的SQL语法有错误;查看与您的MySQL服务器版本对应的手册,以便在mc.CustomerId = ml.CustomerId上使用'inner join microfinance_customers'附近的正确语法       其中ml'在第2行

2 个答案:

答案 0 :(得分:1)

UPDATE micro_finance_loans AS ML 
INNER JOIN micro_finance_customers AS MC on MC.Customer_Id=ML.Customer_Id
SET ML.Loan_status=11
WHERE ML.loan_status=10 AND MC.Number='4410188992243'

答案 1 :(得分:1)

试试这个

UPDATE micro_finance_loans AS 'ML' SET ML.Loan_status=11 from micro_finance_loans
    INNER JOIN micro_finance_customers AS 'MC' on MC.Customer_Id=ML.Customer_Id
    WHERE ML.loan_status=10 AND MC.Number='4410188992243'