如何使用mysql一次查询删除2行

时间:2016-04-21 22:51:13

标签: mysql

大家好我怎么能从一个表中删除一个查询中的2行。我的代码是:

DELETE FROM panel_friends
                WHERE friends_friend_id = ' . $k . ' AND friends_member_id = ' . $key2
AND
                WHERE friends_friend_id = ' . $k2 . ' AND friends_member_id = ' . $key

1 个答案:

答案 0 :(得分:3)

DELETE
FROM    panel_friends
WHERE   (friends_friend_id = :k1 AND friends_member_id = :k2)
        OR
        (friends_friend_id = :k2 AND friends_member_id = :k1)