if you are using mysql 4.x, you might try:

DELETE answers FROM exam e, questions q, answers a WHERE
a.question_id=q.question_id && q.exam_id=e.exam_id;

I've not tested this, though.

-----Original Message-----
From: Andrés Felipe Hernández [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 4:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] delete statement question


    Hi, I hope you can help me with this:

I have these 3 tables.

exam (
    exam_id
    )

questions (
    question_id
    exam_id
    )

answers (
    answer_id
    question_id
    )

I am wondering if i can delete all the rows for answers linked to a given
exam using only one delete statement.

Thanks in advance,

andres


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to