149 Posts
MtnPavlas
10 years ago
Topic

Anybody would know whether SELECT COUNT should or should not work with the SD Databaser typo plugin? Here's the query I'm using:

SELECT COUNT(*) FROM #__cck_store_form_tr_reply WHERE parent_post_id=*value*;

My goal is to use it to count the # of comments related to an article. The idea is to apply the query to use the "Article ID" field and apply the SD Databaser typo plugin to it. The query is simply looking at the Article ID and is supposed to count it in the column "parent_post_id" in the "#__cck_store_form_tr_reply" table.

What I can achieve is to list e.g. all the comments ID's related to the parent article... but can't simply count them. So with the following query the results may be e.g. "20, 91, 125" ... whereas I'd simply want it to be "3".

SELECT (id) FROM #__cck_store_form_tr_reply WHERE parent_post_id=*value*;


Ultimately, my goal is to return a number of article comments in a blog or list view - if anyone has a solution (regardless whether it uses SD Databaser or not), please do share.

Thank you so much, P

Get a VIP membership
10 years ago
0
Level 1

try this:

SELECT COUNT(*) as count FROM #__cck_store_form_tr_reply WHERE parent_post_id=*value*;

Column(s) As Value: count

149 Posts
MtnPavlas
10 years ago
0
Level 1

Sweet - thank you so much. This works like a charm. Folks can now have a # of comments, which is something a few have asked for. Really appreciate your help.

Get a Book for SEBLOD