Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Grouping Query Results

0 views
Skip to first unread message

Mosley

unread,
Jul 20, 2003, 1:31:19 AM7/20/03
to

"John Smith" <3rtwe...@sneakemail.com> wrote in message
news:1p5khvc1kd5qatngs...@4ax.com...
> I have a page that lists records by year. What I would like to do is
> break it down further and list the records by months. However, I'm not
> sure how to accomplish this task. I would appreciate any pointers.
>
> Here's an example of what I want to do:

Well im not sure what you want.

you need to give more info,

you may try this, (with any tag, dont need to be a div)

<DIV style="padding-left : 10" ></DIV>


>
> 2002
> January
> * First Record
> * Second Record
> February
> * First Record
> * Second Record
> March
> * First Record
> * Second Record
>
>
> 2003
> January
> * First Record
> * Second Record
> February
> * First Record
> * Second Record
> March
> * First Record
> * Second Record
>
> Thank you!
>
>
>


Bob Barrows

unread,
Jul 20, 2003, 7:55:28 AM7/20/03
to
In general terms, if the results are in a GetRows array* called arResults,
with year in the first field and month in the second:

dim curYr, newYr, curMth, newMth,i,j

for i = 0 to Ubound(arResults,2)
newYr = arResults(0,i)
newMth = arResults(1,i)
if newYr <> curYr then
curYr = newYr
response.write curYr
response.write "<BR>"
curMth = ""
end if
if newMth <> curMth then
curMth = newMth
response.write "&nbsp;"
response.write curMth
response.write "<BR>"
end if
response.write "&nbsp;*"
for j = 2 to Ubound(arResults,1)
response.write arResults(j,i)
if j < Ubound(arResults,1) then
response.write ";&nbsp;"
end if
next
response.write "<BR>"
next

*A GetRows array is obtained simply by using a recordset's GetRows method:

'say you've opened a recordset called rs:
if not rs.eof then
dim arResults
arResults = rs.GetRows
end if
rs.close
set rs=nothing
'close and destroy your connection as well
if isArray(arResults) then
'insert code from above
else
response.write "No records were returned"
end if

HTH,
Bob Barrows

John Smith wrote:
> I have a page that lists records by year. What I would like to do is
> break it down further and list the records by months. However, I'm not
> sure how to accomplish this task. I would appreciate any pointers.
>
> Here's an example of what I want to do:
>

0 new messages