I'm wondering if someone could help me figure out this query. I have a database with events and clubs (it's for my band's website). The club table has the club name and address information while the event table has the event date and time as well as the club name linked from the club table.
In my calendar page I'm trying to get the club address to show up for each event. But the query below only seems to pull the address information for the first record in the club table while leaving the address blank for the subsequent event records. Therefore, on the calendar page the events that happen to contain the club that is the first record in the club table display the address while the others do not display. I'm guessing that the answer is somewhere in the "SELECT * from clubs" statement but I'm not sure what is needed. Any help would be appreciated. Thanks.
<%
dim RSBODY
dim SQLBODY
Set RSBODY = Server.CreateObject("ADODB.Recordset")
SQLBODY = "SELECT * from SiteSettings"
RSBODY.Open SQLBODY, Conn, 1, 3
%>
<%
Set RSEVENT = Server.CreateObject("ADODB.RecordSet")
RSEVENT.Open "SELECT * FROM Events", Conn, 1, 3
Do while NOT RSEVENT.EOF
rsdate = RSEVENT("Event_Date")
If (Day(rsdate) = dateCounter) AND (Month(rsdate) = CInt(navmonth)) AND (Year(rsdate) = CInt(navyear)) Then%>
<%If RSBODY("Event_Display") = True Then%>
<%=RSEVENT("Category")%>
<%Else%>
<b><%=RSEVENT("Event_Name")%></b><br>
<%=RSEVENT("Description")%>
<%
dim RSCLUB
dim SQLCLUB
Set RSCLUB = Server.CreateObject("ADODB.Recordset")
SQLCLUB = "SELECT * from clubs"
RSCLUB.Open SQLCLUB, Conn, 1, 3
%>
<% If RSEVENT("Event_Name") = RSCLUB("club_name") Then %>
<%=RSCLUB("club_address")%><br>
<%=RSCLUB("club_url")%>
<% End If %>
<% End If
End If
RSEVENT.movenext
Loop
RSEVENT.close
%>