[SQL]: GROUP BY Problems

Ruslan Zasukhin sunshine at public.kherson.ua
Fri Jun 13 22:11:31 CDT 2003


on 6/13/03 22:01, Frank Schima at frank-list2 at mindstarprods.com wrote:

>>> Another problem occurs if I try to also select the RecID, then it does not
>>> work correctly. I brought this up before but I don't remember the
>>> resolution.
>>> Maybe it was to wait for version 2 of the kernel?
>> 
>>     SELECT RecID, t.Type, count(*)      ?
>> 
>> But this is not correct, because RecID is not under GROUP BY.
>> Correct?
> 
> Right, but I tried to put it there too. Can we only have one term in the GROUP
> BY?

No, here can be ANY number of fields.

> Here is the complete SQL that (also) does not work.
> 
> SELECT t. RecID, t.Type, count(*)
> FROM Types t, Patterns p
> WHERE t.RecID *= p.TypePtr
> GROUP BY t.RecID, t.Type
> 
> It returns 2 columns instead of 3.

This really can be a bug...because RecID often require special branch of
code.

Frank, in fact this is danger way.
As only as you add UNIQUE column to GROUP BY (RecID is unique, correct),
You have loose any sense in GROUP BY! because you will get number of groups
equal to the number of records in cursor.

Agree?

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