Funky GROUP BY

Ruslan Zasukhin sunshine at public.kherson.ua
Wed Oct 11 23:38:23 CDT 2006


On 10/11/06 11:26 PM, "Balestrieri, John" <jbalestrieri at ap.org> wrote:

>> Results.VoteCount -- PROBLEM it seems.
>>     I even wonder, why Valentina keep silent on this...
>>     By SQL92 you cannot ORDER BY on field which not in SELECT.
> 
> Yes, this slipped into what I pasted into my email.. I omitted it earlier
> and still have the same results.
> 
>>     Field Results.VoteCount is not in SELECT.
>>     in SELECT present SUM(Results.VoteCount)
>> 
>> May be you want sort by result of SUM() ?
> 
> Generally, intent of the my original SQL should be correct, as I use it in
> the last election with no problems (different Db engine) though if Valentina
> is more accurate, than perhaps the old behavior was not right even thought
> the correct results were returned.

As different db engine I think you mean mySQL.

Yes they allow use ORDER BY for not-selected fields.
Yes we also can generally speaking relax this in SOME cases. Not always.

Yes mySQL allow in SELECT use field that not mentioned in GROUP BY,
BUT they have BIG LETTERS in docs about this to warn:
    you must understand what you are doing.
    and this have sense only if data are specific.


-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list