MySQL Forums
Forum List  »  MySQL Workbench

update using a sub-query
Posted by: agamoto m
Date: December 17, 2008 11:54AM

Hi,

I'm trying to update a field using the result of a sub-query and i'm receiving
the following error:

#1064 - 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 'SELECT T_Final.Valor_Calculado
FROM
(
SELECT
T3.ID,
' at line 4

Bellow is the query:

UPDATE
OBJ_OPER_TOPO
SET
REALIZADO = SELECT T_Final.Valor_Calculado
FROM
(
SELECT
T3.ID,
(T1.REALIZADO*T2.CONTRIBUTO)/100 AS Valor_Calculado
FROM
OBJ_OPER_BASE AS T1
INNER JOIN OBJ_OPER_TOPO_BASE AS T2 ON T2.PAR_OOB_ID = T1.ID
INNER JOIN OBJ_OPER_TOPO AS T3 ON T3.ID = T2.PAR_OPT_ID
) AS T_Final
WHERE
OBJ_OPER_TOPO.ID = T_Final.ID

Could please someone help me with this?

Tks in advance

Aga

Options: ReplyQuote


Subject
Views
Written By
Posted
update using a sub-query
8765
December 17, 2008 11:54AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.