[SQL]: GROUP BY Problems and Explanation.

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Jun 16 19:10:04 CDT 2003


on 6/16/03 16:23, Frank Schima at frank-list2 at mindstarprods.com wrote:

> 
> On Saturday, June 14, 2003, at 10:23  AM, Ruslan Zasukhin wrote:
>> As far as I see, you want count related records in the second table, yes?
>> I have ask self how to do this in SQL Server.
>> Answer is:
>> 
>>  SELECT t.Type, count(t2.Anyfield)
>>  FROM Type t, pattern p
>>  WHERE t.RecID *= p.TypePtr
>>  GROUP BY t.Type
>> 
>> SQL Server for this query returns
>> 
>>  Type A   4
>>  Type B   0
>>  Type C   0
>> 
>> It very looks to be something NON standard also. But have sense by logic.
>> Because count(fld) DO NOT counts records with NULL values (look on outer
>> join last 2 records). So this do follow rules.
>> 
>> What strange here is that they count on a field that NOT present in join
>> table...so this looks to be hacking feature of SQL Server, and as for me I
>> like it...and probably will make for Valentina also..
> 
> That makes sense. Please add this!! As long as there is a way to get the
> number of real 
> records in a related table (using an outer join) then I will be happy. :^)

I will think about this! :-)

-- 
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