Re: Strange sorting behaviour

2022-04-27 Thread John English
On 27/04/2022 17:37, Bryan Pendleton wrote: > There is no natural order for rows in SQL. If you care about the order > of the rows in your result, you must always specify an ORDER BY > clause. Well, the "default" ordering (no ORDER BY clause) reflects the order of insertion. It seems odd to me

Re: Strange sorting behaviour

2022-04-27 Thread Bryan Pendleton
There is no natural order for rows in SQL. If you care about the order of the rows in your result, you must always specify an ORDER BY clause. Instead of putting the ORDER BY in the definition of the view, put the ORDER BY on the SELECT statement from the view. That is, don't do:

Re: Strange sorting behaviour

2022-04-27 Thread Rick Hillegas
Sorting behavior is only defined for the columns in the ORDER BY clause. If a column is not included in the ORDER BY clause, then its sort order can be arbitrary and not even consistent across executions of the query. Hope this helps, -Rick On 4/27/22 4:35 AM, John English wrote: I have a