Boujour à tous, je travaille sous SQL Server (je ne sais pas si ça a une incidence?) et je voudrais savoir si il etait possible d'effectuer une requête update sur 2 champs en utilisant un select.

Je m'explique par le code.

Actuellement je fais ça:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
UPDATE matable1
SET matable1.col3 = (SELECT matable2.col3 
                               FROM matable2
                               WHERE matable1.col1 = matable2.col1
                               AND matable1.col2 = matable2.col2 )
Puis

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
UPDATE matable1
SET matable1.col4 = (SELECT matable2.col4 
                               FROM matable2
                               WHERE matable1.col1 = matable2.col1
                               AND matable1.col2 = matable2.col2 )
Et je voulais savoir si il était possible de faire un truc du genre :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
UPDATE matable1
set matable1.col3,matable1.col4 = (SELECT matable2.col3 ,matable2.col4
                               FROM matable2
                               WHERE matable1.col1 = matable2.col1
                               AND matable1.col2 = matable2.col2 )
Merci d'avance