Forum Moderators: open
<%
do while NOT rsOuter.EOF
if counter1 mod 2 = 0 then bg="#990000"
else
bg="#660000"
end if
%>
My Data here
<%
counter1 = counter1 + 1
rsOuter.MoveNext
loop
%>
<%
MyID = request.queryString("ID")
if ( MyID <>"" ) then
MyID = replace(MyID, "'","''")
end if
%>
sql="Select * From Table1, Table2 WHERE Table2.t2ID = '" & MyID & "' ORDER BY UploadID DESC"
Both t2ID and ID are 'number' fields in an access database.
I've tried writing it as:
Select * From Table1 INNER JOIN Table2 on Table1.ID = Table2.t2ID WHERE Table2.t2ID = '" & getValue & "'"
But nothing shows up this way :(
Any help would be appreciated.
Select * From Table1 INNER JOIN Table2 on Table1.ID = Table2.t2ID WHERE Table2.t2ID = '" & MyID & "'"
so I tried writing it as
Select * From Table1, Table2 WHERE Table2.t2ID = '" & MyID & "'"
(for those with questions here is the VBscript I used to get the MyID variable)
<%
MyID = request.queryString("ID")
if ( MyID <>"" ) then
MyID = replace(MyID, "'","''")
end if
%>
But when I used this statement the repeat regions (I tried many) just kept repeating and crashing my browser. I've since changed it back to the first statement and it seems to be working now. The repeat regions too.
I think I may encounter some issues with some of my pages though. Does anyone have an SQL statement I may be able to use that will work with my Access database and with the repeat regions? It's trial and error I know but I don't have a lot of time to finish this :(
Thanks for all your help.
Select * From Table1 INNER JOIN Table2 on Table1.ID = Table2.t2ID WHERE Table2.t2ID = '" & MyID & "'"
But my Repeat Regions crash when I use this SQL statement:
Select * From Table1, Table2 WHERE Table2.t2ID = '" & MyID & "'"
I wonder does anyone have some sort of solution for me? I find it odd that there is a "Type mismatch" for the first select statement but not for the second. I take it the issue is not in the database then and rather my variables perhaps?
My Joins!? Is it the joins? It's my joins isn't it? Should I be using some sort of outer join? Basically Table1 is a member profile and Table2 is a comments table. So users are leaving comments on the member profile and the data for that member is contained in Table1. Should that be an LEFT OUTER JOIN? I'll try it and let you know if my computer explodes or if it works. I'm running out of computers here though! :(
I know I'm rubbish at programming by the way.
I set up a simple DB like this:
User
Id int
Name varchar
Comment
Id int
UserId int
Comment varchar
If I want all of the comments for the User Id '1' then I would need the following:
SELECT Comment.Id, _Comment.UserId, Comment.Comment
FROM Comment INNER JOIN
User ON Comment.UserId = User.Id
WHERE (User.Id = 1)