Count Same Records Twice
I WAS WONDERING IF IT IS POSSIBLE TO COUNT THE SAME RECORDS(SELECTIONS)TWICE USING 2 DIFFERENT VALUES, 1 POINT THE FIRST TIME AND 2 POINTSTHE SECOND TIME?
dim games
n = NumberOfGames(week)
redim games(n - 1)
sql = "select Schedule.*," _
& " Teams.City as VCity, Teams.Name as VName, Teams.DisplayName as VDisplayName," _
& " Teams2.City as HCity, Teams2.Name as HName, Teams2.DisplayName as HDisplayName" _
& " from (Schedule inner join Teams on Schedule.VisitorID = Teams.TeamID)" _
& " inner join Teams as Teams2 on Schedule.HomeID = Teams2.TeamID" _
& " where Schedule.Week = " & week _
& " order by Schedule.Date, Schedule.Time, Teams.City, Teams.Name"
set rs = DbConn.Execute(sql)
if not (rs.BOF and rs.EOF) then
i = 0
do while not rs.EOF
set games(i) = new GameObj
games(i).setData(rs)
i = i + 1
rs.MoveNext
loop
end if
[1014 byte] By [
MacataQ] at [2007-11-11 8:18:30]

# 2 Re: Count Same Records Twice
apologies
my computer crashed before i was abe to edit my post
subTitle = "Results" %>
<!-- #include file="common.asp" -->
<!-- #include file="header.asp" -->
<% 'Open the database.
call OpenDB()
'Default to current week if no valid number was given.
week = Request("week")
if not IsNumeric(week) then
week = CurrentWeek()
else
week = Round(week)
if week < 1 or week > NumberOfWeeks() then
week = CurrentWeek()
end if
end if
'Find the number of games for this week.
n = NumberOfGames(week)
if NumberOfUsers() = 0 then
call ErrorMessage("No users found in database.")
else
'See if this user is missing any picks for this week.
username = Session("FootballPoolUsername")
if UserTBGuess(username, week) <> "" then
sql = "select count(*) as Total" _
& " from Picks, Schedule" _
& " where Username = '" & username & "'" _
& " and Week = " & week _
& " and Picks.GameID = Schedule.GameID" _
& " and Pick <> ''"
set rs = DbConn.Execute(sql)
if not (rs.BOF and rs.EOF) then
numPicks = rs.Fields("Total").Value
if numPicks < n then
call ErrorMessage("Warning: You are missing one or more picks for this week.")
end if
end if
end if
'Build the display. %>
<table class="main" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th align="left">Name</th>
<th align="center" colspan="<% = n %>">Week <% = week %></th>
<th>TB</th>
<th> </th>
<th align="left" colspan="2">Score</th>
'<th align="left" colspan="2">Paid</th>
</tr>
</thead>
<% 'If the week has been concluded, display the winners.
strWinners = ""
'strPaidWinners = ""
list = WinnersList(week)
'plist = PaidWinnersList(week)
'entries = NumberOfPaidEntries(week)
'if IsArray(plist) then
'for i = 0 to UBound(plist)
'f i > 0 then
'strPaidWinners = strPaidWinners & ", "
'end if
'strPaidWinners = strPaidWinners & plist(i)
'next
end if
if IsArray(list) then
for i = 0 to UBound(list)
if i > 0 then
'strWinners = strWinners & ", "
'end if
'strWinners = strWinners & list(i)
'next
'end if
%>
<tfoot>
'<tr><th align="left" colspan="<% = n + 6 %>">Winner: <% = strWinners %><BR>Paid Winner: <% = strPaidWinners %><BR>Pot:<%=FormatAmount(entries * BET_AMOUNT)%> </th></tr>
</tfoot>
<%
%>
<tbody id="poolResults">
<% 'Display one row per user.
sql = "select *" _
& " from Users" _
& " where Username <> '" & ADMIN_USERNAME & "'" _
& " order by Username"
set rs = DbConn.Execute(sql)
if not (rs.BOF and rs.EOF) then
i = 0
do while not rs.EOF
username = rs.Fields("Username").Value
if Round(i / 2) * 2 = i then %>
<tr>
<%else %>
<tr class="alt">
<%end if
i = i + 1 %>
<td><% = username %></td>
<%
'Display picks for this user, highlight any correct ones.
total = 0
sql = "select *" _
& " from Picks, Schedule" _
& " where Username = '" & username & "'" _
& " and Week = " & week _
& " and Picks.GameID = Schedule.GameID" _
& " order by Schedule.Date, Schedule.Time, Schedule.GameID"
set rs2 = DbConn.Execute(sql)
if not (rs2.BOF and rs2.EOF) then
do while not rs2.EOF
pick = rs2.Fields("Pick").Value
result = rs2.Fields("SpreadResult").Value
if pick = "" then
pick = "--"
end if
if pick = result then
pick = "<strong>" & pick & "</strong>"
end if
if result <> "" then
total = total + 1
end if
%>
<td><% = pick %></td>
<%rs2.MoveNext
loop
rs2.close
i would like to use the same tables(rename them and edit) to count only the last gameand assign it a value of 2
thanx
Mac