0

仍然是一个 mySQL 初学者。我有两个表,follows并且events,它们有这些列:

FOLLOWS
user | profile

EVENTS
user | profile | other_stuff

我想从events用户关注的人那里获取相关事件的列表。

SELECT * FROM follows WHERE user = $userId检索用户关注的人。现在如何从用户关注的任何人中选择与匹配的所有events行?profileprofile

4

1 回答 1

1

像这样:

select * 
from follows f
join events e on e.user = f.user
where f.user = $userId
于 2013-08-27T19:58:14.047 回答