View Single Post
  #2 (permalink)  
Old December 12th, 2003, 06:40 AM
pgtips pgtips is offline
Friend of Wrox
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post

Ok, so you've got the category and item in the same recordset. Your SQL is fine, you need to do the grouping in your asp code. You just need to keep track of the category as you loop through the recordset and only output the category when it changes, something like this:
sCatPrevious = ""
Do While Not rs.EOF

  sCatCurrent = "" & rs.Fields("Category").Value
  If sCatCurrent <> sCatPrevious Then
    ' output the category
    Response.Write sCatCurrent

    ' update the "previous" variable
    sCatPrevious = sCatCurrent

  End If

  ' output the item
  Response.Write "" & rs.Fields("Item").Value

Reply With Quote