Thanks much for the try, but I get an error:
mysql> DELETE
-> poll_questions, poll_answers, poll_votes
-> FROM
-> poll_questions, poll_answers, poll_votes
-> WHERE
-> (poll_questions.poll_id = poll_answers.poll_id)
-> AND (poll_answers.answer_id = poll_votes.answer_id)
-> AND (poll_questions.poll_id = 1);
ERROR 1064: You have an error in your SQL syntax near 'poll_questions,
poll_answers, poll_votes
FROM
poll_questions, poll_answers, ' at line 2
-----Original Message-----
From: Batara Kesuma [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 05, 2002 8:27 AM
To: [EMAIL PROTECTED]
Cc: Daren Cotter
Subject: Re: very tough query
Hi Darren,
On Tue, 5 Mar 2002 09:42:50 -0800
"Daren Cotter" <[EMAIL PROTECTED]> wrote:
> mysql> desc poll_questions;
> +----------------+-----------------+------+-----+------------+---------
> -------+
> | Field | Type | Null | Key | Default | Extra
> |
> +----------------+-----------------+------+-----+------------+---------
> -------+
> | poll_id | int(9) unsigned | | PRI | NULL |
> auto_increment |
> | aim_screenname | varchar(16) | | MUL | |
> |
> | question | varchar(255) | | | |
> |
> | date_created | date | | | 0000-00-00 |
> |
> +----------------+-----------------+------+-----+------------+---------
> -------+
>
> mysql> desc poll_answers;
> +-----------+------------------+------+-----+---------+----------------+
> | Field | Type | Null | Key | Default | Extra |
> +-----------+------------------+------+-----+---------+----------------+
> | answer_id | int(12) unsigned | | PRI | NULL | auto_increment |
> | poll_id | int(9) unsigned | | | 0 | |
> | answer | varchar(255) | | | | |
> +-----------+------------------+------+-----+---------+----------------+
>
> mysql> desc poll_votes;
> +----------------+------------------+------+-----+---------+-------+
> | Field | Type | Null | Key | Default | Extra |
> +----------------+------------------+------+-----+---------+-------+
> | aim_screenname | varchar(16) | | PRI | | |
> | answer_id | int(12) unsigned | | PRI | 0 | |
> | time_voted | timestamp(12) | YES | | NULL | |
> | voter_ip | varchar(15) | | | | |
> +----------------+------------------+------+-----+---------+-------+
>
> DELETE FROM poll_votes AS v, poll_answers AS a, poll_questions AS q
> WHERE (q.poll_id = 1) AND (v.answer_id = a.answer_id) AND
> (a.poll_id = q.poll_id);
I haven't tried it yet, but maybe you can try:
DELETE
poll_questions, poll_answers, poll_votes
FROM
poll_questions, poll_answers, poll_votes
WHERE
(poll_questions.poll_id = poll_answers.poll_id)
AND (poll_answers.answer_id = poll_votes.answer_id)
AND (poll_questions.poll_id = 1);
--bk
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php