Oracle syntax for update with a value from two other tables
I have a table I need to update with a value from two other tables. What's the syntax? Obviously not the same as SQL Server. I may have figured out the need for a subquery, but how do I link the value returned from the subquery to the table being updated?
Table 1 - needs to be updated
Table 2 - links to Table 1
Table 3 - links to Table 2 and has the value needed for the update
' here's a stab at it but it's not quite right:
UPDATE Table1
SET myDateDueValue = (SELECT P.DATEDUETOREP from Table2 U, Table3 P
WHERE P.PROPOSALNUMBER = U.RP_ProposalNumber AND U.RP_PROPOSALNUMBER <> 0) SQ
WHERE REQUESTID = SQ.REQUESTID;
Re: Oracle syntax for update with a value from two other tables
Usual one is something like :
Code:
Update Table1, (SELECT P.DATEDUETOREP from Table2 U, Table3 P
WHERE P.PROPOSALNUMBER = U.RP_ProposalNumber AND U.RP_PROPOSALNUMBER <> 0
) SQ
WHERE table1.REQUESTID = SQ.REQUESTID
SET myDateDueValue = sq.DATEDUETOREP
Please note - I may have got that second where clause in the wrong place...