Subject RE: [firebird-support] How to mimic an UPDATE with a JOIN
Author Alan McDonald
> I would like to do something like this:
>
> UPDATE Versions SET
> Versions.DATA=-1,
> Versions.ATTRIBS=-1
> FROM Versions JOIN Elems ON Versions.ELEM_ID=Elems.ID
> WHERE (Versions.ID <> Elems.GOLDEN_ID
> AND (Versions.NUM <= (Elems.LAST_VER_NUM - 3))));
>
> Unfortunately, at least in 1.0.3 I don't think I can do JOINS in an
> UPDATE statment. Is there another way to do the above without having
> to do an IN ( SELECT ... ) on every record in the Versions TABLE?
>
> As always, thanks in advance...
>
> R.

even if you could do this, it suggests that it is either a on-off update
since you would not be frequently updating records which are already in the
state to which you want to update to. i.e. it's very wasteful to be firing
this off frequently when only a few records will be actually changed. There
must be a better way to manage this sort of thing in your design to do this
frequently, OR if it's one-off, just put up with the time it takes with IN
(SELECT
Alan