Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Group By in ASP page 1

Status
Not open for further replies.
Jul 20, 2001
1,153
0
0
US
Looking to make an ASP page look like an Access report where there are groupings of data.

I.E.

CustID Order ID
1 2
1 3
1 4
2 5
2 6

Becomes

Orders for Cust ID 1
2
3
4
Orders for Cust ID 2
5
6
Etc

Tyrone Lumley
augerinn@gte.net
 
You can run 2 separate SQL statments:
SQL = "select OrderID from table where CustID = 1 order by orderID"
' print table header and results

SQL = "select OrderID from table where CustID = 2 order by orderID"
' print table header and results

Mh


 
If you have a table with your customer details in (unique codes) you could either run for all or selected, or even between dates, whichever query you run,
but you could do it like this

A = id table
B = sales table

open A, goto first record,

do while not A.eof
dim personID
personID = A.id
thing = "select * from B where B.id = personID"
set recset = reccon.execute (thing)whatever
gotofirst reccon
do while not recset.eof
print group header on page
print details
goto next record
loop
goto next record
loop

Something along those lines, sorry it is not actual coding but you get the essence of what i'm saying


Cheers and Stuff

DaveSmith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top