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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Association multiple records to one id

Status
Not open for further replies.

janise

Technical User
May 25, 2003
161
US
Hello everyone again,

I have done this before but for the life of me, could not remember how; and couldn't find a sample of the one I did.

I have an ID, say 123 which can be associated with one or more records.
For instance,
Id records
123 cold days
123 hot days

My question, rather list them the way it looks now, how can I display them to look like this:

_____________________________
123 cold days
hot days
______________________________

I hope you get the picture, if not, I will try explain better.
Thank you in advance
 
use code
Code:
old_val =""

while not rs.eof

  if oldval <> rs("id") then
     response.write rs("id")     
     old_val = rs("id")
  end if
  response.write rs("records")

wend

Bastien

Any one have a techie job in Toronto, I need to work...being laid off sucks!
 
hi Bastien,
thanks for the code,
This code is taking forever to run and hasn't been able complete processing.
It is probably me using your code incorrectly.

Here is what I currently have.
Code:
old_val =""

While Not rstSearch.EOF And rstSearch.AbsolutePage = iPageCurrent
  if oldval <> rstSearch("siteCode") then
     response.write rstSearch("siteCode")
     old_val = rstSearch("siteCode")
  end if
%>
<td>
<%
Response.Write "<a href=""Findfile.asp?siteCode=" & rstSearch("siteCode") & """>"
Response.Write rstSearch("FileName") & "</a>"
%>
</td>
</tr>
<%
wend
This is actual code I am using.
 
Janise,

You could try using a Group by in your select statement.

Select id,record from sometable Group by ID,record

Might be quicker than going through all the records and sorting it out manually. I didn't check my syntax so you might want to run it in a syntax checker. There is also a great SQL resources@
Let me know if it helps.

Cassidy
 
Your missing your Movenext statement, so it's going into an endless loop looking at only the one record. If I had a penny for every time I have done that :) In fact the only reason i don't do it anymore is becaue I had to many unofficial cigarette breaks after I hit the load button and had to wait fo the DLLHOST process to grind to a halt several minutes later.

-T

[sub]01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111[/sub]
The never-completed website:
 
Good catch Tarwn. I hate it when you forget it in a dll and have to kill the process or reboot. Just to recompile and do it again. ;-)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top