• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Populating the top 3

Guest
Jul 19, 2006 Jul 19, 2006

Copy link to clipboard

Copied

Hi, I have a webpage where people can comment on a topic the problem im facing is i want to find out which of all the topics are the top 3 topics (judging by which one has the most comments) can anyone help me in finding out a good way of doing this?? thanks in advance...
TOPICS
Advanced techniques

Views

271

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Jul 20, 2006 Jul 20, 2006
Place each topic in a database table that has a "count" field initializede to zero. When a user selects a topic, retrieve the record for that topic, increase the count field by 1 and update the database. When you want to the top three topics, do a
<CFQUERY NAME="foo" MAXROWS="3" ... >
SELECT topic, count FROM myTable ORDER BY count DESC
</CFQUERY>

Votes

Translate

Translate
Guest
Jul 20, 2006 Jul 20, 2006

Copy link to clipboard

Copied

Place each topic in a database table that has a "count" field initializede to zero. When a user selects a topic, retrieve the record for that topic, increase the count field by 1 and update the database. When you want to the top three topics, do a
<CFQUERY NAME="foo" MAXROWS="3" ... >
SELECT topic, count FROM myTable ORDER BY count DESC
</CFQUERY>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 20, 2006 Jul 20, 2006

Copy link to clipboard

Copied

LATEST
Need some background. Where is the data stored? SQL Server, mySql?
If so, I'm assuming you have a column for topic id and one for comments?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation