[英]SQL - How forum number of pages are calculated
I am working on a similar function that forum had, the number of pages in each forum section. 我正在研究论坛所具有的类似功能,每个论坛部分的页数。
My thought and functions as follow: 我的思想和功能如下:
I have completed all the things except the last two things mentioned above. 除了上面提到的最后两件事,我已经完成了所有的事情。 however, the number of pages has been a problem to me.
但是,页数对我来说是一个问题。 Here's my thought:
这是我的想法:
Is there any possible solution to implement this function? 有没有可能的解决方案来实现这个功能? Or is COUNT(key) is the best approach?
或COUNT(关键)是最好的方法?
You could add a column to your thread table (something like 'postCount'), and then increment it whenever a post is added to that thread. 您可以在线程表中添加一个列(类似'postCount'),然后每当帖子添加到该线程时递增它。 Then you could use that value to determine the number of pages instead of counting the number of posts each time.
然后,您可以使用该值来确定页数,而不是每次计算帖子数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.