SQL de mise à Jour à partir d'une jointure interne

Je suis l'aide de microsoft Access.

Si cette requête:

(SELECT FERMENT.FermentId
FROM FERMENT
INNER JOIN [BELGIUM BEER]
ON
FERMENT.FermentName = [BELGIUM BEER].FermentId ORDER BY [BELGIUM BEER].BeerId) a

retourne FermentId, comment puis-je mettre à jour une table différente avec cette colonne?

Exemple:

UPDATE EXAMPLETABLE
SET EXAMPLETABLE.FermentId = a.FermentId
FROM a
(SELECT FERMENT.FermentId
FROM FERMENT
INNER JOIN [BELGIUM BEER]
ON
FERMENT.FermentName = [BELGIUM BEER].FermentId ORDER BY [BELGIUM BEER].BeerId) a
Si je ne me trompe pas, vous avez besoin d'une relation entre EXAMPLETABLE et la chose que vous sélectionnez à partir, que vous pouvez utiliser quelque chose comme UPDATE EXAMPLETABLE SET EXAMPLETABLE.FermentId = (SELECT FERMENT.FermentId FROM FERMENT INNER JOIN [BELGIUM BEER] ON FERMENT.FermentName = [BELGIUM BEER].FermentId WHERE EXAMPLETABLE.relationFieldName = [BELGIUM BEER].relationField ORDER BY [BELGIUM BEER].BeerId)

OriginalL'auteur user1534664 | 2012-10-14