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) –