|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi there,
I'm having some trouble with the counting function. I've a table with the following fields: Section_title Subsection_title Each subsection is asociated with a section. What I need is an script that displays all that information and also counts how many of each sections are displayed. ie: Section_title Subsection_title Count IT bibliography 2 Users Administration 1 IT free courses 2 How can I do that that 1/2 number count appears? PS: sorry 4 my english. thanks in advance! |
|
#2
|
||||
|
||||
|
Code:
set sections = Conn.execute("SELECT section FROM TableName")
do until sections.eof
set subsectionCount = Conn.execute("SELECT COUNT(*) As subSectionTotal WHERE sectionParentId = " & sections("ParentID"))
Response.write(sections("SectionName") & " - " & subsectionCount("subSectionTotal") & "<br>")
sections.movenext
loop
|
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > Counting problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|