Posts: 8
Location: Nova Scotia, Canada
|
Hi there!
I'm trying to get this SQL statement to work but I'm not sure the syntax. I'm calling on an Access database using ASP.
<%
sql = "SELECT Survey.Topic, Survey.ExpertId, Survey.[Last Name], Survey.[First Name] FROM Survey INNER JOIN [TopicTable] ON TopicTable.TopicID = [Survey].Topic WHERE (((TopicTable.TopicID)=" & Request.QueryString("TopicID") & ")) "
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, conn
%>
Ok...this code works but what I want to do is have like an OR that would do something like this (this code doesn't work )
<%
sql = "SELECT Survey.Topic, Survey.ExpertId, Survey.[Last Name], Survey.[First Name] FROM Survey INNER JOIN [TopicTable] ON TopicTable.TopicID = [Survey].Topic OR TopicTable.TopicID = [Survey].Topic2 OR TopicTable.TopicID = [Survey].Topic3 OR TopicTable.TopicID = [Survey].Topic4 OR TopicTable.TopicID = [Survey].Topic5 WHERE (((TopicTable.TopicID)=" & Request.QueryString("TopicID") & ")) "
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, conn
%>
What I've bolded is what I want but I need the correct syntax. I want to be able to check and see if TopicTable.TopicID equals Survey.Topic, Survey.Topic2, Survey.Topic3, Survey.Topic4, or Survey.Topic5.
Can this even be done...I think it can...I don't use INNER JOIN often.
Hopefully this makes sense...
Thanks!
|