Issue 28531 - Query with aggregation functions are not parsed correctly
Summary: Query with aggregation functions are not parsed correctly
Status: CLOSED DUPLICATE of issue 27286
Alias: None
Product: Base
Classification: Application
Component: code (show other issues)
Version: OOo 1.1.1
Hardware: PC Windows XP
: P2 Trivial (vote)
Target Milestone: ---
Assignee: marc.neumann
QA Contact: issues@dba
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-29 17:08 UTC by cianoz
Modified: 2006-05-31 14:29 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description cianoz 2004-04-29 17:08:14 UTC
I find a big problem trying to run a query in OOo 1.1.1 against MySQL 4.0.18
(the jdbc driver is the last stable: mysql-connector-java-3.0.11-stable)

It seems as OOo does not parse SQL queries if aggregation functions are used,
like SUM(...), COUNT(...) followed by the relative GROUP BY istruction.
A query like this (on a single table, "movim"):

SELECT codart, SUM(qtacar) AS totcar, SUM(qtasca) AS totsca
FROM movim
GROUP BY codart

is perfectly executed and returns the expected results if run from within MySQL
(or using tools like phpmyadmin, MySQL Control Center or others); if run from 
OpenOffice.org, instead it returns the followin error message (it's in italian,
i try to translate it the more correctly i can do)

General error,  message from server: "The promiscuous use of aggregation
functions (MIN(),MAX(),COUNT()...) and it is not illegal if there's not a GROUP
BY clause"

I think the error message have not sense, and moreover, the "...and it is not
illegal if..." sentence looks like an error in the error.

If the query is executed in OOo in the SQL Native Mode, then it works (this
confirm, bypassing OOo that it's correct). 

But if i save the query in OOo in native mode i cannot use it in any form,
because any field to use is returned.

Is it a serious bug or am i missing something ?

Thank you.
Ciano
Comment 1 cianoz 2004-04-29 17:54:39 UTC
I found an english translation with Google for the error message i talked about:

Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is
illegal if there is no GROUP BY clause
Comment 2 Frank Schönheit 2004-04-30 06:53:09 UTC
This is a duplicate of issue 27286

*** This issue has been marked as a duplicate of 27286 ***
Comment 3 marc.neumann 2004-05-06 10:38:19 UTC
close issue