Bonjour à tous,
Voila j'aurais besoin d'une aide pour une requête sql d'insertion.
Alors j'ai 3 tables.
table1
id1 | nom
-----------
24 |
27 |
28 |
table2
id2 | num1
-----------
27 | 442
24 | 445
28 | 447
table3
num2 | nom | prenom
----------------------
442 | nom1 | prenom1
445 | nom2 | prenom2
447 | nom3 | prenom3
Le champs num1 est identique au champs num2.
Le champs id1 est identique au champs id2.
Alors je voudrait en gros insérer dans la table1 les champs nom et prénom concaténé dans le champs nom de la table1 avec des correspondances entre id1 et id2 et entre num1 et num2.
Donc à la fin avoir dans la table 1
id1 | nom
-----------
24 | nom2 prenom2
27 | nom1 prenom1
28 | nom3 prenom3
Voila en espérant que j'ai été assez claire.
Ma requête mais elle ne marche pas:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 Insert into table1 (nom) value ( select nom + prenom from table3 where num2 = ( select num1 from table2 where id2 = ( select id1 from table1 ) ) )
Partager