SQL join with related counts

Ruslan Zasukhin sunshine at public.kherson.ua
Wed Aug 20 09:29:05 CDT 2003


on 8/20/03 9:05, Tim Davis at timdavis at amug.org wrote:

> Hi,
>   If anyone can help with this I'd really appreciate it.
> I'm trying to list all rows of a table, with the quantities of its
> child table records. Here's an example of what I've tried, which
> crashes the server but not the app. (I'm using VServer and V4RB.)
> 
> Select Parent.Field1, Parent.Field2, Count(Child1.ID),
> Count(Child2.ID), Count(Child3.ID)
> From Parent, Child1, Child2, Child3
> Order By Parent.Field1

You need to use GROUP BY Parent.Field1

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list