Click to See Complete Forum and Search --> : Database query help in ASP


pavelushakov
09-13-2005, 12:22 AM
Example Table1 Results
URLID URL
--- -------------
27 www.site1.com
28 www.site2.com
29 www.site3.com


Example Table2 Results
ID URLIDD AID
--- -------- ---
55 28 1
56 28 3
57 28 2


Example Table3 Results
UID Username
--- --------
11 boss1
12 boss2
20 boss3


Example Table4 Results
ID2 AIDD UIDD
--- ------ ---
24 3 20
25 1 20
26 1 20


Table1 and Table2 share value "28" in common.

Table3 and Table4 share value "20" in common.

Table2 and Table4 share value "3" in common.


My question:
How can I write a query that will loop through the Table results until it finds a matching record set between Table2 and Table3 to Table4?

Hope this helps with my question:
If UID = UIDD And AID = AIDD Then
Do Nothing
Else
Response.Redirect "gosomewhere.asp"
End If

minority
09-13-2005, 03:34 AM
scrap

pavelushakov
09-13-2005, 04:30 AM
Gee thanks for the reply minority. :rolleyes:

BTW: I meant tables and not database.

minority
09-13-2005, 05:35 AM
sorry lol i had posted something then read your post and it meant my post was garbage lol meant scrap my post lol

usually when i do a db call like what you are after i do it like the following.

select ID FROM user where Username = username

then i use the id to get my next value from next table.

select link from links where User_ID = "&rs("ID")&"

alternatively if you just want to use the value from one table you can do this

SELECT * FROM table WHERE ( SELECT ID From Table WHERE User_ID = "&Textfield&")

that process i guess can be expanded to fit more sub queries in i think