I Have three tables.
tbllogin
L.userid
tblprofile
P.userid,p.profileid,name,surname,etc
tblWatches
WatchingUserID,watchedprofileid
In each table these ids are the same
L.userid,P.userid,WatchingUserID
In the query below I collect all the watchedprofileid, being followed by WatchingUserID
watchedprofileid = p.profileid
Expand|Select|Wrap|Line Numbers
- lngprofileid=CLng(Request("UserID"))
- If lngprofileid <> "" And lngprofileid <> 0 Then
- Set rs=Server.CreateObject("ADODB.Recordset")
- rs.CursorLocation = 3
- SQLQuery="Select L.accept, etc,etc,etc FROM tbllogin L INNER JOIN tblprofile P ON L.UserId = P.UserId "
- SQLQuery= SQLQuery & " where
- SQLQuery= SQLQuery & " p.ProfileID in (Select WatchedProfileID from tblWatches where WatchingUserID = 0" & Clng(lngprofileid) & ")"
- SQLQuery= SQLQuery & " order by L.latestvisit desc"
Unfortunately as the query is written no combination and playing around with the query will get that info.
I just wondered if there was a different way to achieve the same result plus info from tblprofile about the userid that is used in the query.
Any pointers would be a great help
Thanks in advance
Richard