Quiz 6.x-4.0-alpha4 is running great for me overall, but whenever I attempt to add a new multi-choice question to a quiz, I receive an error like this:

user warning: Column 'nid' in where clause is ambiguous query: SELECT DISTINCT(n.nid), vid, title FROM node n LEFT JOIN support_ticket st ON n.nid = st.nid WHERE ( (st.client IN (1) OR st.client IS NULL)) AND ( type = 'quiz' AND nid NOT IN (152) )ORDER BY changed LIMIT 9 in /home/mysite/public_html/sites/all/modules/quiz/question_types/quiz_question/quiz_question.core.inc on line 330.

I don't actually know if this is a problem with Support or Quiz (or both). I seem to recall this type of error resulting from two different modules attempting to use db_rewrite_sql() at the same time, but I really don't know what's going on. Although this error appears on the question creation page (and when I add more alternatives to the page), it does not appear to be affecting the functioning of Quiz in any way (although I haven't fully tested this yet).

I'm using Drupal 6.14 (and 6.x-1.3 of Support module) on a server with PHP 5.2.9 and MySQL 5.0.85.

Thanks for all the work put into this great module!

Comments

sivaji_ganesh_jojodae’s picture

Change line no. ~331 in file quiz/question_types/quiz_question/quiz_question.core.inc to

$sql = "SELECT n.nid, n.vid, title
          FROM {node} n
          WHERE type = 'quiz'";

Note : Prefix n. appended to field nid and vid.

Let me know how this works.

spazfox’s picture

Thanks for the help. I tried the change suggested in #1 and am receiving essentially the same error:

user warning: Column 'nid' in where clause is ambiguous query: SELECT DISTINCT(n.nid), n.vid, title FROM node n LEFT JOIN support_ticket st ON n.nid = st.nid WHERE ( (st.client IN (1) OR st.client IS NULL)) AND ( type = 'quiz' AND nid NOT IN (152) )ORDER BY changed LIMIT 9 in /home/foxy/public_html/sites/all/modules/quiz/question_types/quiz_question/quiz_question.core.inc on line 330.

sivaji_ganesh_jojodae’s picture

Status: Active » Fixed

I installed support module and able to reproduce the same error here. The line causing this error is

 $sql .= " AND nid NOT IN ($found)";

adding alias n to nid fixed this issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

m_i_c_h_a_e_l’s picture

I am getting a very similar error. It happens when I try to view Myresults. I can see my total score, but nothing appears under "Question results".

user warning: Column 'nid' in on clause is ambiguous query: SELECT question_nid, question_vid, type, rs.max_score FROM quiz_node_results_answers ra LEFT JOIN node n ON (question_nid = nid) LEFT JOIN quiz_node_results r ON (ra.result_id = r.result_id) LEFT OUTER JOIN quiz_node_relationship rs ON (question_vid = rs.child_vid) AND rs.parent_vid = r.vid WHERE ra.result_id = 1 ORDER BY answer_timestamp in /sites/all/modules/quiz/quiz.module on line 3138.

This is a Short Answer quiz. I am using the latest release of Quiz module. I am not using Support module.

I am also using URL Aliases. From the comments above, it sounds like the answer lies there. Please explain more clearly the issue of "add alias n to nid".

If that is not the solution, I would appreciate any guidance you can give.

somatics’s picture

This issue is not solved yet, by the way: It's still present in Drupal 7 when using the Support Ticket module.

My issue about this is at http://drupal.org/node/1376120