Subject | Union + order by 1 fails |
---|---|
Author | kokok_kokok |
Post date | 2005-02-04T11:00:11Z |
I have use FB 1.5.2
the following sentence does not work properply and returns any order:
select entrydate, id from customers where type=2
union
select entrydate, id from customers where type=3
order by 2 asc, 2 asc
I expect that the above sentence sort by Id column but it does not work.
If I replace "order by 2 asc, 2 asc" by "order by 2 asc, 1 asc" or by
"order by 2 asc", then it works fine. Also if it works if I do not use
"union"
I know that to type "2 asc" 2 times is stupid, but the sql sentence is
created from a sql wizard. I have solved to cleaning the second "2
asc" if it is the same, but in any case I think that Firebird should
work fine in all cases.
the following sentence does not work properply and returns any order:
select entrydate, id from customers where type=2
union
select entrydate, id from customers where type=3
order by 2 asc, 2 asc
I expect that the above sentence sort by Id column but it does not work.
If I replace "order by 2 asc, 2 asc" by "order by 2 asc, 1 asc" or by
"order by 2 asc", then it works fine. Also if it works if I do not use
"union"
I know that to type "2 asc" 2 times is stupid, but the sql sentence is
created from a sql wizard. I have solved to cleaning the second "2
asc" if it is the same, but in any case I think that Firebird should
work fine in all cases.