Salve, è la prima volta che mi cimento con delle query in cui sia prsente una inner join e mi dà problemi che non capisco. La query è la seguente:
e mi dà dei problemi legati alla prima query (ma credo che me li dia anche con la seconda). Il database è fatto nel seguente modo:codice:<% set rsCategorie = server.CreateObject("adodb.recordset") Sql = "select * from stCategorie INNER JOIN"_ &" Categorie ON stCategorie.id_Sezione = stSezione.id order by stCategorie.nome" rsCategorie.Open Sql, Cn,1,3 rsCategorie.MoveFirst while not rsCategorie.EOF %> <tr> <td width="100%" height="24" style="border-style: none; border-width: medium" colspan="2" background="images/sito/thumb4.gif"> <%=rsCategorie("nome")%></td> </tr> <tr> <td width="8%" height="11" style="border-style: none; border-width: medium" valign="top"> </td> <td width="92%" height="11" style="border-style: none; border-width: medium" valign="top"> <% set rsSottocategorie = server.CreateObject("adodb.recordset") Sql = "select * from stSottocategorie where id_categorie='"&rsCategorie("id")&"' order by nome" rsSottocategorie.Open Sql, Cn,1,3 while not rsSottocategorie.EOF link = rsSottocategorie("link") if link = "" then %> <%=rsSottocategorie("nome")%> <% else %> "><%=rsSottocategorie("nome")%> <% end if rsSottocategorie.movenext wend %> </td> </tr> <% if not rsCategorie.EOF then rsCategorie.MoveNext end if wend %>
sezione: id , nome
stCategorie: id , id_sezione , nome
stSottocategorie: id, id_categoria , nome, link
Ho messo i colori per indicarvi la corrispondenza che vorrei creare. Sapete darmi una mano? Grazie mille a tutti![]()

Rispondi quotando
