ASP
--
Questions
--
Followers
Top Experts
SQLmatch = "select f1.filmid , count(f1.filmid) as popularity from filmkarakter f1 where ((f1.filmid <> "&filmmatch&") AND (f1.brugerid <> "&brugernr&") AND f1.karakter=6) and f1.brugerid in (Select f2.brugerid from filmkarakter f2 where (f2.filmid="&filmmatch&" AND f2.karakter=6 AND f2.brugerid <> "&brugernr&")) group by f1.filmid order by 2 desc"
It macth on one movie at a time(filmmatch), but I need it to match on a unlimitted number of movies.
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
SQLmatch = "select f1.filmid , count(f1.filmid) as popularity from filmkarakter f1 where ((f1.filmid NOT IN ("&filmmatch1&","&filmmatc
I'm testing it with brugerid=4
My table:
id filmid karakter brugerid
9 1 6 4
17 3 6 4
14 1 6 2
13 2 6 2
12 3 6 2
11 2 6 3
18 1 6 3
3 2 6 5
1 1 6 5
6 3 6 5
2 3 5 8
5 2 5 7
15 1 4 13
7 2 4 9
4 3 3 6
10 2 3 12
8 2 2 11
16 1 0 14
with your values I have the following results:
in (1,2,3) -> no rows;
in (1,2) -> (3,2);
in (1) -> (2,3),
(3,2);
in (2) -> (1,3),
(3,2);
in (3) -> (1,2),
(2,2);
in (2,3) -> (1,3);
in (1,3) -> (2,3);
what's unexpected here?






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
in(1,2) -> (3) and (3)
in(1) -> (2,3) and (2,3)
can u see the pattern? it gives me the result 2 times
single query can't return "no rows" twice!
in (1,2) returns filmid = 2 and popularity = 3
in (1) returns two rows
filmid = 2 and popularity = 3
and
filmid = 3 and popularity = 2
Seems to be quite correct, doesn't it?
Have you put the filmmatch list into both places of filmid filter occurences?
filmmatch2=2
SQLmatch = "select f1.filmid , count(f1.filmid) as popularity from filmkarakter f1 where ((f1.filmid NOT IN ("&filmmatch1&","&filmmatc
I use it in a loop and it gives me a print with filmid=3 twice

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
agregate query can't return the same grouping column value more than once. Most likely there is something wrong with loop. Do you fetch from recordset until eof? Or you use some other way?
SQLkar = "select filmid from filmkarakter WHERE brugerid="&brugernr&" ORDER BY ID"
Set RSkar = Server.CreateObject("ADODB
RSkar.CursorLocation = 3
RSkar.CursorType = 3
RSkar.ActiveConnection = Conn
RSkar.Open SQLkar, Conn, 1, 3
If NOT (RSkar.BOF AND RSkar.EOF) Then
do until RSkar.eof
filmmatch1=1
filmmatch2=2
SQLmatch = "select f1.filmid , count(f1.filmid) as popularity from filmkarakter f1 where ((f1.filmid NOT IN ("&filmmatch1&","&filmmatc
Set RSmatch = Server.CreateObject("ADODB
RSmatch.CursorLocation = 3
RSmatch.CursorType = 3
RSmatch.ActiveConnection = Conn
RSmatch.Open SQLmatch, Conn, 1, 3
If NOT (RSmatch.BOF AND RSmatch.EOF) Then
do until RSmatch.eof
filmid=RSmatch("filmid")
SQLmatch2 = "SELECT Titel FROM video WHERE FilmID="&filmid&" ORDER BY FilmID"
Set RSmatch2 = Server.CreateObject("ADODB
RSmatch2.CursorLocation = 3
RSmatch2.CursorType = 3
RSmatch2.ActiveConnection = Conn
RSmatch2.Open SQLmatch2, Conn, 1, 3
titel=RSmatch2("Titel")
RSmatch2.close
Set RSmatch2 = Nothing
%>
<tr><td class="blaa10"><a href="film.asp?film=<%=fil
<tr><td height="3"><img src="grafik/space.gif" height="1"></td></tr>
<%RSmatch.movenext
loop
ELSE%>
<tr><td class="blaa10">Ikke nok oplysninger endnu.</td></tr>
<%
End If
RSmatch.close
Set RSmatch = Nothing
%>
<%RSkar.movenext
loop
ELSE%>
<tr><td class="blaa10">Ikke nok oplysninger endnu.</td></tr>
<%
End If
RSkar.close
Set RSkar = Nothing
%>






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
ASP
--
Questions
--
Followers
Top Experts
Active Server Pages (ASP) is Microsoft’s first server-side engine for dynamic web pages. ASP’s support of the Component Object Model (COM) enables it to access and use compiled libraries such as DLLs. It has been superseded by ASP.NET, but will be supported by Internet Information Services (IIS) through at least 2022.