Subject Re: Problems with "Order by"
Author Ingo Breker
Hello again!

As the select statements are automatically build – and this generator
is quite complex – the order columns can be recurred.
And with this the described sorting problem can occur.

My questions now are:
- Is there any sense why the database backend changes / mixes the sorting
- Is this a known or an unknown bug
- Does anybody know an easy solution for this problem

If not I have to debug my procedures and that means a lot of fume that
will come out of my brain.

So if someone could help me, I `d be very VERY grateful!

Cheerio




--- In firebird-support@yahoogroups.com, Uwe Grauer
<mailinglists@o...> wrote:
> indo2605 wrote:
>
> So tell me please, what the hell should this do?
> There is only one field named billno. If you would have billno1 and
> billno2, this should work.
>
> Uwe
>
> >Hello,
> >
> >I have some problems when I use column in an "order by"-statement more
> >than one time. I have created an test-scenanrio:
> >
> >CREATE TABLE TEST (
> > ID1 INTEGER NOT NULL,
> > CUSTOMER INTEGER NOT NULL,
> > BILLNO INTEGER NOT NULL,
> > AMOUNT NUMERIC(15,5),
> > PRIMARY KEY (ID1));
> >
> >INSERT INTO TEST(ID1, CUSTOMER, BILLNO, AMOUNT) VALUES (1,1,3,4);
> >INSERT INTO TEST(ID1, CUSTOMER, BILLNO, AMOUNT) VALUES (2,2,2,5);
> >INSERT INTO TEST(ID1, CUSTOMER, BILLNO, AMOUNT) VALUES (3,2,4,7);
> >INSERT INTO TEST(ID1, CUSTOMER, BILLNO, AMOUNT) VALUES (4,1,6,8);
> >INSERT INTO TEST(ID1, CUSTOMER, BILLNO, AMOUNT) VALUES (5,2,5,9);
> >INSERT INTO TEST(ID1, CUSTOMER, BILLNO, AMOUNT) VALUES (6,2,7,8);
> >
> >
> >After excecuting the following SQL-Statement
> >
> >SELECT CUSTOMER, BILLNO, SUM(AMOUNT) FROM TEST
> >GROUP BY CUSTOMER, BILLNO
> >HAVING SUM(AMOUNT) != 0
> >ORDER BY BILLNO
> >
> >everything works fine, until I replace the last line with:
> >
> >ORDER BY BILLNO, BILLNO
> >
> >
> >