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

Technote (FAQ)


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


If the table in DB2 Everyplace 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 result set order depends or when the record was inserted.


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

Document information

More support for:

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 Mobile

Software edition:

Edition Independent

Reference #:


Modified date:


Translate my page

Content navigation