Gabor Boros
unread,Jun 30, 2021, 9:04:48 AM6/30/21Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to firebird...@googlegroups.com
Hi All,
See the example below. Why the order by not have an effect in this case
and how to get same result with the three different versions? (A simple
select * from tbl1 order by 1, 2 or select * from tbl1 order by 2, 1
give same result for all versions.)
CREATE TABLE TBL1 (F1 INTEGER, F2 VARCHAR(10), F3 VARCHAR(10), F4
VARCHAR(10));
INSERT INTO TBL1 (F1, F2, F3, F4) VALUES (1, '27', 'Y', 'X');
INSERT INTO TBL1 (F1, F2, F3, F4) VALUES (25, '12', 'Y', 'X');
with list1 as (select * from tbl1 order by 1, 2)
select cast(list(f1) as varchar(10)) f1, cast(list(f2) as varchar(10))
f2, f3, f4
from list1
group by 3, 4;
2.5
F1 F2 F3 F4
========== ========== ========== ==========
25,1 12,27 Y X
3.0
F1 F2 F3 F4
========== ========== ========== ==========
25,1 12,27 Y X
4.0
F1 F2 F3 F4
========== ========== ========== ==========
1,25 27,12 Y X
with list1 as (select * from tbl1 order by 2, 1)
select cast(list(f1) as varchar(10)) f1, cast(list(f2) as varchar(10))
f2, f3, f4
from list1
group by 3, 4;
2.5
F1 F2 F3 F4
========== ========== ========== ==========
25,1 12,27 Y X
3.0
F1 F2 F3 F4
========== ========== ========== ==========
25,1 12,27 Y X
4.0
F1 F2 F3 F4
========== ========== ========== ==========
1,25 27,12 Y X
Gabor