Page 1 of 1

Query Help

Posted: Sun Oct 03, 2004 7:32 pm
by Joe
Is it possible to use COUNT(*) when using an OUTER JOIN. My query looks like:

Code: Select all

SELECT members.ID, comments.comment FROM members, comments
WHERE members.ID = comments.ID;
I wish for the members ID to be shown but at the same time I wish to count the number of rows which hold the same ID as members.

Posted: Sun Oct 03, 2004 10:31 pm
by feyd
generally all joins can use a grouping function, however you will need a group by.

Posted: Mon Oct 04, 2004 9:14 am
by bling
Yeah, just group by all the fields you select. As long as they are all "unique" you shouldn't have a problem, however this group by might slow down your query a good deal.

If your rows aren't unique then you will also have to group by some unique identifier.