MySQL Forums
Forum List  »  General

Query Help
Posted by: Ry Ferguson
Date: February 06, 2005 07:43PM

Hi,

I need help with a MySQL Query. Let me give you an overview of the tables involved:

comments table:
----------------
entry_id: entry the comment was made on, an integer
comment_id: unique id for this comment, an integer
poster_id: member id who made this comment, an integer

entries table:
-------------
entry_id: unique id for this entry, an integer

(*let me know if you need more table info)


ok, the query: the number of entries a specific member has made at least one comment on.

this is what i have now:

SELECT COUNT(*) AS count FROM comments c WHERE c.poster_id = 23 GROUP BY c.entry_id;

the above query basically returns the number of times a specific member(in this case member 23) has commented on an entry. so what i want is the number of rows returned here in just a single count variable. I know a could just count the rows in this data set when returned to PHP but that's a little inefficient.

Options: ReplyQuote


Subject
Written By
Posted
Query Help
February 06, 2005 07:43PM
February 06, 2005 11:45PM
February 07, 2005 01:45PM
February 14, 2005 12:19AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.