[V4Rb] Error 346

Ruslan Zasukhin sunshine at public.kherson.ua
Tue Dec 9 08:45:25 CST 2003


on 12/9/03 2:41 AM, Charles Yeomans at yeomans at desuetude.com wrote:

> I do -- except that the query
> 
> SELECT Matters.matter_name, Matters.last_changed,
> SUM(TimeEntries.time_worked) FROM Matters, TimeEntries GROUP BY
> Matters.matter_name
> 
> does execute, and returns correct results.
> 
> ?

No Charles!

IF you have GROUP BY clause,

Then SELECT can contain ONLY and ONLY

    constants
    field mentioned in the GROUP BY
    aggr funcs.


So this is wrong:


SELECT 
    Matters.matter_name,
    Matters.last_changed,           <<<<<<<<<< this is normal field.
    SUM(TimeEntries.time_worked)
FROM 
    Matters, 
    TimeEntries 
GROUP BY 
    Matters.matter_name



-------------------
You can have only 

SELECT 
    Matters.matter_name,
    SUM(TimeEntries.time_worked)
FROM 
    Matters, 
    TimeEntries 
GROUP BY 
    Matters.matter_name



--------------------
Just think,

Aggregative function take FEW records, and calculate ONE value.
But you ask to show Matters.last_changed also.

>From what record it must be?   => ambiguity.


Again, this is not Valentina specific. This is STANDARD RULE.


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