Subject Re: [firebird-support] UPDATE AND DELETE WITH JOIN
Author Svein Erling Tysvaer
Roberto Freitas wrote:
> Hello,
> This is a valid sentence with SQL Server:
> UPDATE MAT SET MAT.MT=137
> FROM MAT INNER JOIN ALU ON MAT.ALREG = ALU.ALREG
> WHERE ALU.EDCOD='TWQ';
> With FireBird 1.5 I get Token unknow line 2 char 1 FROM
> How can I do this kind of UPDATE with FireBird 1.5?
> How can I do a similar DELETE (with JOIN) with FireBird 1.5?

UPDATE MAT SET MAT.MT=137
where MAT.ALREG = (select ALU.ALREG from alu WHERE ALU.EDCOD='TWQ');

This works if ALU.EDCOD is unique, if not you have to do something like

UPDATE MAT SET MAT.MT=137
where exists (select * from ALU WHERE ALU.EDCOD='TWQ' and MAT.ALREG =
ALU.ALREG);

HTH,
Set