|
From: Jamie M. <ja...@mc...> - 2007-08-29 14:41:04
|
eri...@ja... (Eric Dannewitz) writes:
> select stories.sid,stories.stoid, count(comments.uid) nocomments
> from stories, comments where stories.stoid=3Dcomments.sid group by
> 2 order by 3;
I think what you want is something like
SELECT stories.sid, stories.stoid,
COUNT(DISTINCT comments.uid) AS num_users,
COUNT(*) AS num_comments
=46ROM stories, comments
WHERE stories.discussion=3Dcomments.sid
GROUP BY stories.stoid
ORDER BY num_users DESC LIMIT 10;
(The GROUP BY could be stories.sid with the same effect, since both
sid and stoid are unique in that table.)
--=20
Jamie McCarthy
http://mccarthy.vg/
ja...@mc...
|