Forums

ASP

This topic is locked

SELECT based on previous SELECT

Posted 23 Apr 2002 22:53:48
1
has voted
23 Apr 2002 22:53:48 Alberto Alexander posted:
i want to retrieve data from a database based on a dyanimic SELECT sql query. basically:
select * from tblTheTable where theCAT = '" & TheCat & "'
so after that pulls the filtered data i want another select to pull data from another table with matching keys from the data that was originally pulled.
does anyone understand this and know how to do it?



Edited by - teajook on 23 Apr 2002 22:54:36

Edited by - teajook on 23 Apr 2002 22:54:58

Replies

Replied 29 Apr 2002 21:11:46
29 Apr 2002 21:11:46 johannes nel replied:
If I understand you correct :
1. you want to build a recordset based upon select statement. = call this recordset myFirstResult

->. then use this (myFirstResult) to populate for example, a dropdown box/textbox

-> when the user selects from this dropdown box you want to populate other textfields dropdown boxes, getting the data from a select * from myFirstResult where... type of story

first the good news -- you can easily do it --> there r 2 models to do this
1st option: you can guide the user down a sequestial path of .asp pages and build the finl querystring (the select statement).

2nd option: invloves doing it on the client. this requires xml.
If you want to, u can mail me and I will send u some code which does this and some more, but if you do not write code yourself this will be a waste of time for both of us...

my mail :

goodluck

Replied 29 Apr 2002 21:17:44
29 Apr 2002 21:17:44 Alberto Alexander replied:
actually i figured it out. what did was have an initial recordset that repeated in rows. within those rows there is a select box. what i did was write while statement that compared the repeating record from the initial recordset and the second recordset. and produce the results while values within two columns within the recordsets matched. it was a bit of a pain to do since i had to write an if statement to check if it had produced an .EOF and if so do a MoveFirst().
of course this took two days of some serious thinking but turned out to just be about 5 lines of code that did all of this. im learning this asp stuff slowly but surely.
thanks for the suggestion. i've yet to do anything in xml and would be interested in seeing your idea.

Reply to this topic