Subject | How to mimic an UPDATE with a JOIN |
---|---|
Author | robert_difalco |
Post date | 2005-07-06T22:32:46Z |
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.
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.