[V4Rb] Error 346

Charles Yeomans yeomans at desuetude.com
Tue Dec 9 13:22:07 CST 2003


On Tuesday, December 9, 2003, at 01:45  AM, Ruslan Zasukhin wrote:

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

And I believe it.  But what I am saying is that Valentina returns 
correct data for the query

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

So is this a bug in Valentina?  And why does the following query fail 
with error 346?

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


Charles Yeomans



More information about the Valentina mailing list