Skip to main content

Why is the order of the output (in DB2E) different when WHERE clause is used?


Technote (FAQ)


Question

Why can the order of the output be different when a WHERE clause is used?

Cause

If the table in DB2Everyplace has an index over one of the fields, If you use a WHERE clause the, the order of the output may be sorted by the index.

For a query with WHERE clause, since there is index on one of the columns, the record retrieving is performed by index searching. For another query without the where clause, the data file is returned sequentially. To some extent, the later scenario for the resultset order depends or when the record was inserted.


Answer

If you want to ensure a consistent order of the resultset on a column, you can always use ORDER BY syntax to sort the resultset.

Rate this page:

(0 users)Average rating

Copyright and trademark information

IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.

Rate this page:


(0 users)Average rating

Add comments

Document information

DB2 Everyplace

General Issues


Software version:
9.1.0, 9.1.1, 9.1.2, 9.1.3, 9.1.4, 9.1.5


Operating system(s):
AIX, Linux, Palm OS, Solaris, Symbian OS, Windows, Windows Handhelds


Software edition:
Edition Independent


Reference #:
1618169


Modified date:
2013-01-25

Translate my page

Content navigation