如何使用三个对象进行最佳的休眠查询?
我有一个疑问,但我不知道如何使其最佳。我有三个对象。
- SCP
- 问题:它有一个指向 SCP (SCP_id) 的字段
- 答案:它有一个指向问题 (question_id) 的字段
我如何进行查询来计算给定 SCP 内的答案数量
I have a query but I don't know how to make it optimal. I have three objects.
- SCP
- Question : it has a field that points SCP (SCP_id)
- Answer : it has a field that points Question (question_id)
How can I make a query that counts the number of answer within a given SCP
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
怎么样:
它会生成以下 SQL:
看起来相当高效。
What about this:
Which generates the following SQL:
Seems pretty efficient.