Affichage plusieurs niveaux

carolet Messages postés 26 Date d'inscription mercredi 9 avril 2003 Statut Membre Dernière intervention 26 septembre 2013 - 2 juil. 2010 à 10:10
carolet Messages postés 26 Date d'inscription mercredi 9 avril 2003 Statut Membre Dernière intervention 26 septembre 2013 - 6 juil. 2010 à 09:38
Bonjour,

Mon problème :

Je veux lister une table d'articles (nommée LIGNESCDE) ainsi que les articles composants chacun de ces articles, composantes se trouvant dans une autre table (nommée LIGNENOMENCLATURE). Et chaque composants contient lui-même des composants. Je ne sais pas si je suis claire.

J'y arrive, mais ma méthode ne me permet pas de trier ma liste par ordre alphabétique. J'ai essayé avec un union all, mais comme j'ai plusieurs niveaux, je ne sais pas si ça peut fonctionner, en tout cas je n'y arrive pas.

Quelqu'un aurait une idée ?

Merci



Mon code actuel :


<% Set ENTETECDE = oCon.execute("SELECT CODE,CODEDOCUTIL,CODETIERS FROM APISOFT_DOS_DELAHOUSSE_SA.ENTETECDECLIENT where CODEDOCUTIL='"&request.form("numcde")&"'")%>
<% Set LIGNESCDE = oCon.execute("SELECT CODEDOCUMENT,CODEARTICLE,DESIGNATION, QUANTITE FROM APISOFT_DOS_DELAHOUSSE_SA.LIGNECDECLIENT where CODEDOCUMENT='"&entetecde(0)&"' and codearticle is not null ORDER BY CODEARTICLE")%>


<% do until LIGNESCDE.EOF%>

<%'____COMPOSANTE NIVEAU 1_______________________________________%>

<% Set COMPO = oCon.execute("SELECT codenomenc,codecompo,quantite,designation FROM APISOFT_DOS_DELAHOUSSE_SA.LIGNENOMENCLATURE where CODENOMENC='"&LIGNESCDE(1)&"' and codecompo<>' ' ")%>

<% While Not COMPO.EOF%>
<%if COMPO(1)="864-1000" then%>
<tr>
<th scope="col" height="62"><%=LIGNESCDE(1)%></th>
</tr>

<%else%>

<%'____COMPOSANTE NIVEAU 2_______________________________________%>

<% Set COMPO2 = oCon.execute("SELECT codenomenc,codecompo,quantite,designation FROM APISOFT_DOS_DELAHOUSSE_SA.LIGNENOMENCLATURE where CODENOMENC='"&COMPO(1)&"' and codecompo<>' ' ")%>
<% While Not COMPO2.EOF%>
<%if COMPO2(1)="864-1000" then%>
<tr>
<th scope="col" height="62" bgcolor="#BABABA"><%=compo(1)%></th>
</tr>

<%else%>

<%'____COMPOSANTE NIVEAU 3_______________________________________%>

<% Set COMPO3 = oCon.execute("SELECT codenomenc,codecompo,quantite,designation FROM APISOFT_DOS_DELAHOUSSE_SA.LIGNENOMENCLATURE where CODENOMENC='"&COMPO2(1)&"' and codecompo<>' ' ")%>
<% While Not COMPO3.EOF%>
<%if COMPO3(1)="864-1000" then%>
<tr>
<th scope="col" height="62" bgcolor="#808080"><%=compo2(1)%></th>
</tr>

<%else%>
<%'____COMPOSANTE NIVEAU 4_______________________________________%>

<% Set COMPO4 = oCon.execute("SELECT codenomenc,codecompo,quantite,designation FROM APISOFT_DOS_DELAHOUSSE_SA.LIGNENOMENCLATURE where CODENOMENC='"&COMPO3(1)&"' and codecompo<>' ' ")%>
<% While Not COMPO4.EOF%>
<%if COMPO4(1)="864-1000" then%>
<tr>
<th scope="col" height="62" bgcolor="#666666"><%=compo3(1)%></th>
</tr>

<%else%>


<%end if%>
<%COMPO4.MoveNext%>
<%Wend%>

<%end if%>
<%COMPO3.MoveNext%>
<%Wend%>


<%end if%>
<%COMPO2.MoveNext%>
<%Wend%>
<%end if%>

<%COMPO.MoveNext%>
<%Wend%>



<%LIGNESCDE.MoveNext%>
<%LOOP%>

2 réponses

Edoth Messages postés 19 Date d'inscription lundi 21 avril 2008 Statut Membre Dernière intervention 2 février 2011
2 juil. 2010 à 13:43
dans ta requete sql tu as une commande ASC ou DESC qui te permet de trier tes résultats

tu peux regarder ici : http://sql.1keydata.com/fr/sql-order-by.php
0
carolet Messages postés 26 Date d'inscription mercredi 9 avril 2003 Statut Membre Dernière intervention 26 septembre 2013
6 juil. 2010 à 09:38
Oui, ça d'accord.
Mais ce que je veux c'est que toute ma liste (mélangeant les 4 niveaux) soit triée, c'est-à-dire que si l'un des résultats du niveau 4 est avant l'un des résultats du niveau 1, il s'affiche avant.
0
Rejoignez-nous