delete left join?
Posted: Fri Sep 21, 2007 1:40 am
Hello, I was under the idea that I can delete records using the left join.
I also read that I can subsitute "delete" with "select" to ensure that I get the records I am targeting prior to actually running the delete. I would think that this implies that I should be able to change "select" to "delete" and get the desired results.
Not so in the case of trying to run a left join - delete.
Perhaps this is not possible, I don't kow I'm a newb.
here is the delete query I was running:
I am not getting any result, but a syntax error. after running the query through phpmysql I get this message:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*
FROM
student_info
LEFT JOIN
st' at line 2
I also read that I can subsitute "delete" with "select" to ensure that I get the records I am targeting prior to actually running the delete. I would think that this implies that I should be able to change "select" to "delete" and get the desired results.
Not so in the case of trying to run a left join - delete.
Perhaps this is not possible, I don't kow I'm a newb.
here is the delete query I was running:
Code: Select all
$delete_query =
"DELETE
*
FROM
student_info,
LEFT JOIN
student_parent
USING
(sid)
LEFT JOIN
parent_info
USING
(pid)
LEFT JOIN
classes_students
USING
(sid)
WHERE
sid = ".$result1['sid']." ";#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*
FROM
student_info
LEFT JOIN
st' at line 2