Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL Queries

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-11-16 : 07:03:29
Mike writes "Have table with 3 fields (cause, date, name) where multiple records exist with the same information except one field (date). How can I display (using ASP) one instance of the cause & name info and the multiple date data?"

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2004-11-16 : 09:49:37
Select your recordset (order by the fields that will be the same first: something like cause, name, date)

Then you can loop through the recordset and show it however you need to. Just keep track of which cause & name you are on... something roughly like:


Rs = openRecordSet...

curCause = ""
curName = ""
sectionDivide = false
While not (Rs.Bof or Rs.Eor)
if curCause<>Rs("cause") then sectionDivide = true
if curName<>Rs("name") then sectionDivide = true
if sectionDivide then
curCause = Rs("Cause")
curName = Rs("Name")

'do Header type stuff here
end if

'do body or detail type stuff here

Rs.movenext
Wend
Set Rs = nothing


Corey
Go to Top of Page
   

- Advertisement -