【发布时间】:2013-10-12 08:02:21
【问题描述】:
我有三个表'users'、'friends'、'friendsrequests'。
'Users' 包含 id、firstname 和 lastname,'friends' 和 'friendsrequests' 都包含 users_id_a 和 users_id_b。
当我搜索新朋友时,我选择 id's where firstname is LIKE :whatever 或 lastname LIKE :whatever。但是,我想排除其他两个表中存在的那些 id。
我知道如何通过应用程序逻辑来解决这个问题,但我也知道我不应该这样做。我知道我不应该链接 SELECT 语句并且应该使用连接。
【问题讨论】:
标签: mysql