Column: 'TOPIC_ID' in field list is ambiguous
HejVed eksekvering får jeg: "Column: 'TOPIC_ID' in field list is ambiguous". Hvorfor?
'## Forum_SQL - Find all records with the search criteria in them
strSql = "SELECT DISTINCT C.CAT_STATUS, C.CAT_NAME, C.CAT_ORDER"
strSql = strSql & ", F.F_ORDER, F.FORUM_ID, F.F_SUBJECT, F.CAT_ID, F.F_PRIVATEFORUMS"
strSql = strSql & ", F.F_PASSWORD_NEW, F.F_STATUS"
strSql = strSql & ", T.TOPIC_ID, T.T_AUTHOR, T.T_SUBJECT, T.T_STATUS, T.T_LAST_POST"
strSql = strSql & ", T.T_LAST_POST_AUTHOR, T.T_REPLIES, T.T_UREPLIES, T.T_VIEW_COUNT"
strSql = strSql & ", M.MEMBER_ID, M.M_NAME, MEMBERS_1.M_NAME AS LAST_POST_AUTHOR_NAME "
strSql2 = " FROM ((((" & strTablePrefix & "FORUM F LEFT JOIN " & strActivePrefix & "TOPICS T"
strSql2 = strSql2 & " ON F.FORUM_ID = T.FORUM_ID) LEFT JOIN " & strActivePrefix & "REPLY R"
strSql2 = strSql2 & " ON T.TOPIC_ID = R.TOPIC_ID) LEFT JOIN " & strMemberTablePrefix & "MEMBERS M"
strSql2 = strSql2 & " ON T.T_AUTHOR = M.MEMBER_ID) LEFT JOIN " & strTablePrefix & "CATEGORY C"
strSql2 = strSql2 & " ON T.CAT_ID = C.CAT_ID) LEFT JOIN " & strMemberTablePrefix & "MEMBERS MEMBERS_1"
strSql2 = strSql2 & " ON T.T_LAST_POST_AUTHOR = MEMBERS_1.MEMBER_ID"
strSql3 = " WHERE (T.T_STATUS > 1 OR R.R_STATUS > 1)"
if mlev = 3 and ModOfForums <> "" then
strSql3 = strSql3 & " AND T.FORUM_ID IN (" & ModOfForums & ") "
end if
strSql4 = " ORDER BY C.CAT_ORDER, C.CAT_NAME, F.F_ORDER, F.F_SUBJECT, T.T_LAST_POST DESC"
mypage = request("whichpage")
if ((Trim(mypage) = "") or (IsNumeric(mypage) = False)) then mypage = 1
mypage = cLng(mypage)
if strDBType = "mysql" then 'MySql specific code
if mypage > 1 then
intOffset = cLng((mypage-1) * strPageSize)
strSql5 = strSql5 & " LIMIT " & intOffset & ", " & strPageSize & " "
end if
'## Forum_SQL - Get the total pagecount
strSql1 = "SELECT COUNT(TOPIC_ID) AS PAGECOUNT "
response.write "<br>Webmaster er klar over fejlen<br>"
response.write strSql1 & strSql2 & strSql3
set rsCount = my_Conn.Execute(strSql1 & strSql2 & strSql3)
iPageTotal = rsCount(0).value
rsCount.close
set rsCount = nothing
