这是我尝试过的:$query="DELETE FROM network_friend WHERE friend_request = :usrfriend AND friend = :isfriend UNION DELETE FROM network_friend WHERE friend_request = :friend_request AND friend = :friendisfriend";我有列结构相同的结构而不是friend1 friend2 friend1可能就像friend2 friend1 friend2如何删除情况下,如果列:friend_request或friend_is_friend是相同的用户和 朋友列是我要删除的用户?就像是 "DELETE FROM table WHERE friend = :user1 AND friend_request = :user2 AND friend_is_friend = :user2"或者反过来"DELETE FROM table WHERE friend = :user2 AND friend_request = :user1 AND friend_is_friend = :user1"问题是我需要删除的情况下user1 = friend_request,并user1 friend_is_friend和还friend = user2逆也可能是在地方user 1 user 2和地点user 2 user 1如何使用多个条件删除并将其变成单个语句?
2 回答
沧海一幻觉
TA贡献1824条经验 获得超5个赞
我想你想要:
DELETE nf FROM network_friend nf WHERE (friend_request = :usrfriend AND friend = :isfriend) OR (friend_request = :friend_request AND friend = :friendisfriend)
智慧大石
TA贡献1946条经验 获得超3个赞
我觉得是=D
$sql = 'DELETE FROM network_friend WHERE friend_request = friend_is_friend AND friend = :user_you_want_to_delete';
- 2 回答
- 0 关注
- 113 浏览
添加回答
举报
0/150
提交
取消