Bonjours , alors voila j'ai un soucis , ca va etre dur a expliquer ...
Alors j'ai une premiere requete qui renvoie 3 enregistrement ensuite pour chacun de ces trois enregistrement j'ai une requete qui utilise le resultat d'un enregistrement ... un exemple vaut mieu:
Donc cette requete me retourne 3 enregistrement :18 , 19, 20
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 select article.idart from article,arp,profils,ppe,personne where article.pack=1 and personne.idper=ppe.idper and ppe.idpro=profils.idpro and profils.idpro=arp.idpro and arp.idart=art.idart and personne.login='lelogin'
ensuite
celle ci me retourne une liste d'article
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 select * from PACK,ARTICLE where pack.idart=article.idart and pack.idartpac=19
Donc j'aimerai avec le resultat de la premiere requete alimenter le pac.idartpac de la deuxieme.
J'ai donc essayer ca :
Le probleme est que ca me retourne le resultat mais sous 3 resultat different , moi je voudrait le resultat en une seul table
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 DECLARE @idart int DECLARE LISTE_PACK CURSOR FOR select article.idart from article,arp,profils,ppe,personne where article.pack=1 and personne.idper=ppe.idper and ppe.idpro=profils.idpro and profils.idpro=arp.idpro and arp.idart=article.idart and personne.login='lelogin' OPEN LISTE_PACK FETCH NEXT FROM LISTE_PACK INTO @idart WHILE @@FETCH_STATUS = 0 BEGIN select * from PACK,ARTICLE where pack.idart=article.idart and pack.idartpac=@idart FETCH NEXT FROM LISTE_PACK INTO @idart END CLOSE LISTE_PACK DEALLOCATE LISTE_PACK
si quelqu'un a une idée..
merci
Partager