count calculation problem

Results 1 to 2 of 2

Thread: count calculation problem

  1. #1
    Join Date
    Dec 1969

    Default count calculation problem

    I have a table recording hits to various pages arranged by topic. The table stores a topic_id key linking to a table of topics, and a user_id which links a user table. Each time a topic link is clicked a record gets added to a hits table including the topic_id and the user_id. I need to query this hits table to get how many users have clicked on 1 topic, how many users have clicked on 2 topics, how many users have clicked on 3, etc, etc, right up to how many users have clicked on all topics. The topic itself is not relevant, just how many. What's the best way of doing this?

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default RE: count calculation problem

    select topicid, count(userid) userid from TableName group by topicid<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts