0

Hye ,

I am having this kind of problem. Could anyone please help me why I am getting this error?

UPDATE company_alert
SET company_alert.alert_value = company_financial.receivable
FROM company_alert INNER JOIN company_financial
ON company_alert.stock_code=company_financial.stock_code
WHERE company_financial.year_id=company_alert.year_id

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 'FROM company_alert INNER JOIN company_financial
ON company_alert.stock_code=comp' at line 3

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by simplypixie
0

As far as I am aware you can't use FROM in your UPDATE statement, you need to put it in a sub-query. For example:

UPDATE company_alert
SET company_alert=
(SELECT company_financial.receivable FROM company_financial INNER JOIN company_alert
ON company_alert.stock_code=company_financial.stock_code
WHERE company_financial.year_id=company_alert.year_id)

This may not work, but it should give you the idea.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.