Subject Re: Jaybird and SELECTs with ORDER BY
Author topikpl
Got it! (see below)

> Strange. In general, Jaybird respects (or should respect, at least
> nothing was coded differently) the order in which data are returned
> from the server...

You were right - results are the same, whether by Jaybird, isql or IB
Expert.

What was not the same - was the query. But the thing was not obvious
(at least for me). In my Java app the SELECT query was like following:

SELECT field1, field2, field3 <...the rest>

and in IB Expert I copied and pasted the query, but changed fields to
* so I could see more. So the query in IB Expert was:

SELECT * <...the rest>

What makes the fields "ordered" is the inclusion of ID field (in my
case the ID field is pk) in SELECT (sic!).

I made additional test and changed ID of one of the rows to max(ID)+1.
The row was then returned in the query as last in the sequence of
other rows not differentiated by ORDER BY clause. That means including
pk field in a query makes it sorted by the pk - at least when it comes
to Firebird. Something new to me.

Thanks for reply and help!

Regards,