
August 2nd, 2004, 06:04 PM
|
|
Registered User
|
|
Join Date: Aug 2004
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
using JOIN/INTERSECT on same table in a loop
I am doing the following query using intersect but gives me an error in sql syntax. I tried using join as well but gives me
similar error. In the following code still has intersect just to show exactly what I want to do. My query in mysql console is working without using intersect or join.
$query_objects = "";
for ($i=0; $i<$num_questions; $i++) {
if ($i != 0)
$query_objects = " intersect ";
$query_objects = $query_objects .
"select distinct obj from answer where qid=" . $asked_questions[$i] .
" and ans=" . $asked_answers[$i];
}
|