Hello everyone. I'm using SQL 7.0 on NT4. I made a forum that uses SELECT COUNT(*) to count the number of replies and display them. Unfortunately, I think that's slowing down the system. I made a column called "Replies" and now can't seem to get a script to update the Replies column. The forum works like this:
Every post has a unique Post ID and a ReTo column. ReTo is 0 if it's a new thread ot it has the Post ID of which it is replying to. I tried to do something in ASP to loop through each Post but took too long and kept timing out. The script works great for 1 to 500 posts at a time. But I need to do about 20,000 posts! Here's the script for updating 1 post, maybe someone can help me make it work for all rows:
UPDATE tblRMEWebBoard
SET Replies =
(SELECT COUNT(*) FROM tblRMEWebBoard WHERE ReTo = 1)
WHERE PostID = 1
That will count the number of replies to post 1 and set the Replies column to however many replies there are. I tried using WHERE IN's and other statements without much success. Hope someone can help!!!
Thanks a lot in advance!!
Turtle
Every post has a unique Post ID and a ReTo column. ReTo is 0 if it's a new thread ot it has the Post ID of which it is replying to. I tried to do something in ASP to loop through each Post but took too long and kept timing out. The script works great for 1 to 500 posts at a time. But I need to do about 20,000 posts! Here's the script for updating 1 post, maybe someone can help me make it work for all rows:
UPDATE tblRMEWebBoard
SET Replies =
(SELECT COUNT(*) FROM tblRMEWebBoard WHERE ReTo = 1)
WHERE PostID = 1
That will count the number of replies to post 1 and set the Replies column to however many replies there are. I tried using WHERE IN's and other statements without much success. Hope someone can help!!!
Thanks a lot in advance!!
Turtle