0
$deleteUser = $_POST['userId'];

$query =    "DELETE FROM users AS USERS
           LEFT JOIN posts AS POSTS
           ON USERS.id = POSTS.postAuthor
           WHERE USERS.id = '$deleteUser' AND POSTS.postAuthor = '$deleteUser'";

我正在尝试删除用户和他们可能创建的任何帖子。我错过了什么?

4

1 回答 1

1

指定执行的表或DELETE别名

DELETE USERS FROM users AS USERS
       LEFT JOIN posts AS POSTS
       ON USERS.id = POSTS.postAuthor
WHERE USERS.id = '$deleteUser' AND POSTS.postAuthor = '$deleteUser'
于 2012-11-08T05:30:05.787 回答