Subject RE: [firebird-support] Problem group by in front-end (odbc)
Author Larry Johnson
Tried that, too, successfully:



SELECT AL5.NAME FROM SYSDBA.MEDIATYPE AL5 WHERE (AL5.MEDIATYPE_ID IN (2, 3, 4)) group by 1 ORDER BY 1 DESC



No issues.



Which ODBC driver version? I’m using version 02.00.0144 of OdbcFb32. You should make sure you also have the 2.1 client for Firebird, since the ODBC driver will use it as well.



From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of olaf.kluge@...
Sent: Sunday, December 21, 2008 1:30 PM
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] Problem group by in front-end (odbc)



Hi,
thanks for helping.
the first example does not work too, the result is the same error message. The second thing with the distinct-command works fine. I don't know, which way is the faster, but the grouping-way doesn't work.
the group by 1 does msaccess not understand, perhaps it is a problem of the firebird-odbc-driver.
once again, thank you!



Hmmm. I'm not sure what the issue might be. I tried a very similar
statement to yours, and it works fine in 2.1. Here's my test:

SELECT AL5.NAME FROM SYSDBA.MEDIATYPE AL5 WHERE (AL5.MEDIATYPE_ID IN (2, 3,
4)) group by AL5.NAME ORDER BY 1 DESC

(The aliasing shouldn't be necessary, I wouldn't think.)

This might be an Access issue. In any case, a couple of workarounds you
could try with your SQL:

1) Add something to the query that might normally require a GROUP BY
clause: Example:
SELECT TPROJEKTE.KOMMISIONSNR, count(1)
FROM TPROJEKTE
WHERE (((TPROJEKTE.KUNDE)=[forms]![FAuftragNeu].[skunde]))
GROUP BY TPROJEKTE.KOMMISIONSNR
ORDER BY TPROJEKTE.KOMMISIONSNR DESC;

2) Replace the GROUP BY with a DISTINCT option on the SELECT list:
SELECT DISTINCT TPROJEKTE.KOMMISIONSNR
FROM TPROJEKTE
WHERE (((TPROJEKTE.KUNDE)=[forms]![FAuftragNeu].[skunde])) ORDER BY
TPROJEKTE.KOMMISIONSNR DESC;

From: firebird-support@yahoogroups.com <mailto:firebird-support%40yahoogroups.com>
[mailto:firebird-support@yahoogroups.com <mailto:firebird-support%40yahoogroups.com> ] On Behalf Of olaf.kluge@... <mailto:olaf.kluge%40satron.de>
Sent: Sunday, December 21, 2008 12:35 PM
To: firebird-support@yahoogroups.com <mailto:firebird-support%40yahoogroups.com>
Subject: RE: [firebird-support] Problem group by in front-end (odbc)

Hi,
the error message: odbc aufruf fehlgeschlagen (odbc call failed) The
orderby-statement is the problem, but I brougth the data sorted by desc not
asc (automatically without ourderby-statement)
I also must group by, without group by the statement works well.
Olaf

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]





[Non-text portions of this message have been removed]