Subject Re: order-by problem
Author Adam
--- In firebird-support@yahoogroups.com, "martinknappe" <martin@...>
wrote:
>
> Ok, thanx Adam,
> I only thought that because the entries where ordered by asterm
> descending, id descending when I picked them in the procedure, a simple
> order by asterm ascending, id ascending
> would revert that order. Dunno if you follow my apparently wrong logic
> but I still can't see why that's wrong...

And you still haven't explained where Firebird got it wrong. From what
I can tell, it ordered everything according to your Order By Clause,
the fact seems to be that you wanted it in some other order.

Look, if I run your ORIGINAL query, I get this

CNT ASTERMOUT

==== ============================================================
20 Automatik-Abisolierzange, f

19 Automatik-Sicherheitsgurt, m

18 Automatikantenne, f

17 Automatikgetriebe, n

16 Automatikgurt, m

11 Automatische Umluft Control, f

7 Automobilklebstoff, m

6 Autopolitur, f

5 Autoradio, n

4 Autostaubsauger, m (1)

3 Autostaubsauger, m (2)

2 Autowachs, n

1 Autowaschanlage, f

15 automatisch zuschaltender Allradantrieb, m

14 automatische Abisolierzange, f

13 automatische Bremsanlage, f

12 automatische UKW-Stör-Unterdrückung, f

10 automatische Umluftregelung, f

9 automatischer Blockierverhinderer, m ABV

8 automatisches Getriebe, n


Do you expect record cnt=15 to be immediately below record cnt=16??

I warned you that the ordering was case sensitive in a previous message:

http://groups.yahoo.com/group/firebird-support/message/76475?threaded=1&var=1&p=6


"Two things to note:

1) By default, the order by will put all the upper case characters first
.....
"

For English characters, you can simply change your query to.

select *
from get_prior_20('Autowaschanlage, f', 47)
order by Upper(astermout) ascending, idout ascending

In fact, you no longer need to return the cnt if this is the order you
want.

I do not know the ordering rules for umlauts etc, so you may need to
read up on COLLATIONS to get it right. With the example we are looking
at it works correctly.

Adam