Print Page | Close Window

Counting records from a specific field??

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=3271
Printed Date: 29 March 2026 at 3:41pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Counting records from a specific field??
Posted By: Nischint
Subject: Counting records from a specific field??
Date Posted: 04 June 2003 at 1:57pm
I have two tables in the database, one called topics, and another called comments.

On the topics.asp page, the latest record is shown, with a topic id, title, date and summary. At the end of the summary, is a link that asks the user whether he'd like to comment on the topic. So the link reads something like:

<a href="comments.asp?topicid=<%=topicid%>">Post a comment</a>

Now I'd like to show how many comments that particular topic already has, on this link. How do I do that??

In the comments table, the fields are topicid (the one commented on), userid, username and usercomment. So I tried setting up a query, to count the number of comments for a particular topicid, but it didn't work.

Help??


-------------
A better idiot

http://www.jamlikethat.com">Jam Like That



Replies:
Posted By: ljamal
Date Posted: 04 June 2003 at 9:00pm
You should be able to use:

select count(topicID) from table where topicID = x

where x is the topicID

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net