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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.