Subject Re: [firebird-support] Valid reasons for sorting on a column one doesn't select?
Author Stefan Balzter
plinehan schrieb:
> Can anyone give me a few valid reasons why
> one might want to sort on a field that
> one doesn't select?

I just happen to have such a situation myself: The data of a certain
table in my db can be sorted (and re-sorted) by the user in any
arbitrary order.
To accomplish that, I use an internal ordering column. I won't use the
primary key for sorting because it is referenced by a foreign key in
another table (a real big one), and ON UPDATE CASCADE would cause an
awful lot of updates each time a record is moved.
Thus, my ordering column is changed every time the user moves a record
up or down in the client app. The table is always displayed using ORDER
BY ordering_col. But the user doesn't give a *** about what values this
column has, so I never display this column.

Apart from that, my client app gives the user full control about which
columns to show and by which columns to order. It'd be a painful
explanation why this feature would have to be cancelled if I moved to
such a "mighty" dbms like oracle...