2 Replies Latest reply on Jul 20, 2006 6:53 AM by drforbin1970

    Populating the top 3

    WOLFcfm Level 1
      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...
        • 1. Populating the top 3
          jdeline Level 1
          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
          • 2. Re: Populating the top 3
            drforbin1970 Level 1
            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?