Page 1 of 1

Delete Multiple Rows on a Many-to-Many Relationship Table

Posted: Fri Feb 08, 2013 12:14 pm
by bwan37
Is it possible to Delete Multiple Rows on a Many-to-Many Relationship Table?

eg..
TABLE student_choice (
student_id int(3),
course_taken varchar(16),
PRIMARY KEY(student_id, course_taken)
}

Data:
student_id | course_taken
001 | math
001 | english
002 | math
002 | biology


I want to delete all of "001" record!
Can I do it in one simple delete statement?
Thanks for the help!

Re: Delete Multiple Rows on a Many-to-Many Relationship Tabl

Posted: Fri Feb 08, 2013 1:59 pm
by Christopher
You mean like this?:

DELETE FROM student_choice WHERE student_id='001'

Re: Delete Multiple Rows on a Many-to-Many Relationship Tabl

Posted: Fri Feb 08, 2013 11:00 pm
by bwan37
Ouch!!! that's what I mean...
@_@ Thanks @_@