简体   繁体   中英

Update table column with inner join

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'

Can someone please tell me whats the error in this query, error as:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'inner join microfinance_customers as mc on mc.CustomerId=ml.CustomerId where ml' at line 2

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'

Try this instead

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'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM