mysql - 如何使用SQL查找unfollow页面?

标签 mysql sql database

我想在Mysql中找到取消关注的页面,并显示用户不关注的页面列表,让他关注...

这是我的结构:

user: id, name [....]
page: id, name, up [...]
follows : id, user_id, page_id 

我想获取用户不关注的页面列表。

最佳答案

select user.id as userid, page.id as pageid 
  from user, page 
  where pageid not in(select page_id from follows where user_id = userid) 

http://ideone.com/ixAcxg

关于mysql - 如何使用SQL查找unfollow页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42545077/

相关文章:

mysql - 基于重复项的 data.frame 条件求和

同一张表上的MySQL多子查询

mysql - Laravel 5.7 迁移拆分读写数据库时出现问题

mongodb - 在 Mongo 中存储嵌套类别(或分层数据)的最有效方法?

MySQL:在数据库中查找活跃客户的查询

mysql - NiFi中无法连接binlog客户端

mysql - 对行进行分组和计数,然后在条件中使用它们

sql - 跟踪表中的更改

sql - 参数化语句能阻止所有SQL注入(inject)吗?

php - 我想按类别显示贷方或借方金额 我只收到贷方金额