Subject Re: [firebird-support] Problems with "Order by"
Author Uwe Grauer
indo2605 wrote:

>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
>
>
>
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

>
>