查找属于另一个集合的集合
我确信对此有一个简单的答案,但不确定如何措辞来搜索它。
鉴于文章属于用户,如果我有一组三个不同的用户,我如何通过一个查询访问这些用户中的任何一个所写的所有文章?
I'm sure there's an easy answer for this, but not sure how to word it to search for it.
Given that articles belong to users, if I have a set of three different users, how can I access all of the articles written by any of those users with one query?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
鉴于 user_ids 是用户 id 的数组:
Given that user_ids is an array of the user ids:
hellvinz 的回答帮助我解决了这个问题:) 由于这些文章属于用户,这意味着它们具有
user_id
属性。我现在觉得这个很愚蠢 xD保存一个连接,生成一个更简单的查询。
谢谢!
hellvinz's answer helped me work it out :) Since the articles belong to users, that means that they have the
user_id
attribute on them. I feel pretty silly about this one now xDSaves a join, producing a simpler query.
Thanks!