|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
I have a question regarding counting records in a database. I have fields called EventName and EventVolunteer. What I want to do is do a count of volunteers for each event. Then as it loops though the database the results display next to the Event Name. I looked around but didn't see anything close to what I'm looking for. Hope this makes sense. Thanks.
|
|
#2
|
|||
|
|||
|
Open your recordset (called 'rs' for simplicity here) and do something like:
Code:
SQL = "SELECT DISTINCT EventName FROM table"
If dbOpenQuery(rs,SQL) then
Do while not rs.EOF
str = str & rs("EventName") & "<br>"
SQL2 = "SELECT EventVolunteer FROM table WHERE EventName = '" & rs("EventName") & "'"
If dbOpenQuery(rs2,SQL2) then
Do while not rs2.EOF
str = str & rs2("EventVolunteer") & "<br>"
rs2.Movenext
Loop
dbCloseQuery rs2
Else
str = str & "No volunteers...<br>"
End if
rs.Movenext
Loop
dbCloseQuery rs
Else
str = str & "No events...<br>"
End if
Response.Write str
As always, more than one way for programming something ![]() |
|
#3
|
|||
|
|||
|
Thanks!
I was actually able to find a solution from the 4guysfromrolla.com forums. Thanks for your reply though.
-dj |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Counting Records in the DB |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|