You've just been lucky (or unlucky, as the case may be) having any
recognizable order from various clients. The DB2 documentation and the
SQL standard state very clearly that one cannot assume any implied order
if no ORDER BY clause is included in the statement.
-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Mike Burdette
Sent: Monday, May 04, 2009 11:29 AM
To: java400-l@xxxxxxxxxxxx
Subject: Re: SQL works from green screen, but not in WAS with JDBC...
Thanks for your suggestion, Neill. We will try including an ORDER BY
clause after the GROUP BY clause to sort the data.
It will take some time to test this, however as we will have to promote
it to our QA environment (paperwork, etc...).
_The odd thing is, this query works on the SQL command line (STRSQL) on
both DEV and QA as well as from the web service in WAS on our
development box. It just does not return the data sorted as desired
from the web service in WAS on QA.
Thank you for your suggestion...we'll let you know how it goes.
Mike
------------------------------------------------------------------------
-------------
message: 7
date: Fri, 1 May 2009 22:38:19 +0100
from: "Neill Harper" <neill.harper@xxxxxxxx>
subject: RE: SQL works from green screen, but not in WAS with JDBC...
Ahh I see to be fair you have stated that you want ascending order..
.sorry
:-)
This might help.
Unlike the ORDER BY clause, the GROUP BY clause does not order data.
Include
an ORDER BY clause after your GROUP BY clause if you want to sort data
in a
particular order or sort on an aggregate in the projection list.
-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Mike Burdette
Sent: 01 May 2009 22:02
To: java400-l@xxxxxxxxxxxx
Subject: SQL works from green screen, but not in WAS with JDBC...
All:
We have an issue where an SQL statement from a Java application (web
service) running in WAS Express 6.1, JDK 1.5, returns different results
than when the statement is run in the green screen using STRSQL on the
same
iSeries. The statement runs correctly from green screen. To complicate
the
matter, the statement will run on another WAS Express 6.0 App server,
using
JDK 1.4, as well as on the green screen for this iSeries.
Here is the statement:
SELECT FLD2, FLD3, MIN(MINFLD) AS MINFLD, FROM LIB.FILENAME where ....
GROUP BY MINFLD, FLD2, FLD3, ... fetch first 100 rows only (statement
has
been altered to change the field names and for brevity).
The GROUP BY does not seem to work on the 6.1 server. We want the
records
returned in ascending order by MINFLD.
Any thoughts would be appreciated.
Thanks
--
This is the Java Programming on and around the iSeries / AS400
(JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.