Hello!
I was hoping that someone could help me with an "OR" query that's not working as planned. Essentially, I'm try to pick off correctly answered questions (submitted_homework table) from a quiz tied to my data base OR questions that students have a chance to try again from a second table (understood_questions). If I run the second part of the OR, it gives me back the correct id numbers, but if I run the query as is, it just spits back all of the question information from the first half of the query as opposed to all question information using the question_id's from both the first part of the OR statement and second part of the OR statement. Any help would be appreciated...
Thank you,
Eric
Code:SELECT * //get all the question info such as question id, text, solution FROM questions INNER JOIN submitted_homework USING (question_id) WHERE submitted_homework.assignment_id = $assignment AND submitted_homework.user_id = $student AND submitted_homework.submitted_solution = questions.solution //first part does as it should OR question_id IN //trying to use these question_ids in this //table as well but it's a no go! (SELECT question_id FROM understood_questions WHERE understood_questions.user_id=$student AND understood_questions.assignment_id=$assignment



Reply With Quote




Bookmarks