Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
仍然是一个 mySQL 初学者。我有两个表,follows并且events,它们有这些列:
follows
events
FOLLOWS user | profile EVENTS user | profile | other_stuff
我想从events用户关注的人那里获取相关事件的列表。
SELECT * FROM follows WHERE user = $userId检索用户关注的人。现在如何从用户关注的任何人中选择与值匹配的所有events行?profileprofile
SELECT * FROM follows WHERE user = $userId
profile
像这样:
select * from follows f join events e on e.user = f.user where f.user = $userId