0
我正在制定一個計劃生成器,其中每個團隊都與其他團隊進行比賽。我的數據庫中的表,我需要像下面的輸出, 匹配計劃生成器算法
我至今嘗試過是
<%
ResultSet rsteams = clmmodel_database.selectQuery("select count(ct.teamid) as teamcount, teamid,teamname from clm_team ct");
while(rsteams.next()){
int teamcount = rsteams.getInt("teamcount");
int n = teamcount - 1;
int numofmatches = n*(n+1)/2;
%>
<h1>Team Count = <%out.print(teamcount);%></h1>
<h1>Number of Matches = <%out.print(numofmatches);%></h1>
<table>
<%for(int i =0;i<n;i++){%>
<tr>
//Here I need to display the matches row by row
</tr>
<%}%>
</table>
<%}%>
以檢索團隊數和匹配的數量進行播放。請幫助我。
如何從兩行中同時檢索兩個值?因爲兩個組的ID和名稱都在兩行 –
您可以使用ResultSet.absolut方法(索引從1開始)http://docs.oracle.com/javase/6/docs/api/java/sql/ResultSet。 HTML#絕對(INT) –