Subject Re: [firebird-support] Update statement syntax
Author Ann W. Harrison
Norman McFarlane wrote:
> For the record, here is a complete example of the UPDATE ... JOIN syntax that I
> posted earlier. This from one of my current projects.
>
> UPDATE CD
> SET
> C_ACCEXEC=AE.C_ACCEXEC
> FROM Customer_Details CD
> JOIN AccountExec AE ON (CD.C_ACCEXEC=AE.Name OR CD.C_ACCEXEC=AE.Name+' 2')
> Note the use of the keyword FROM to denote the table which is being updated.
>
> I hope this finally helps.

That syntax doesn't work in Firebird, nor is it part of standard SQL.

This does and is.

UPDATE CustomerDetails CD1
SET CD1.C_ACCEXEC = SELECT MAX (AE.C_ACCEXEC)
FROM Customer_Details CD2
JOIN AccountExec AE
ON (CD2.C_ACCEXEC=AE.Name OR CD2.C_ACCEXEC=AE.Name||' 2')


Note that the concatenation operator for Firebird (and standard SQL) is
|| not +

Regards,


Ann