View Single Post
  #3 (permalink)  
Old September 9th, 2003, 08:34 AM
planoie's Avatar
planoie planoie is offline
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

So you need to group by "order no." and then display a separate table for each "order no." with a corresponding subtotal. Normally I would provide a suggestion on how to do this in your SQL statement, but it would typically involve a stored procedure. And you asked for an ASP solution so here's some pseudo code...

Modify your query to order by "order no."

nLastOrderNo = firstRecord("order no.")
for each record
    if nLastOrderNo <> currentRecord("order no")
        output total row with nTotalAmount
        nTotalAmount = 0
    end if
    output 1 record
next record
output total row for final total in nTotalAmount

Hope that makes sense.

Peter