Hello,

I have an unexpected result with this request (tested with H2 1.4.193, it 
works fine with Oracle):

create table test(id number(5));

insert into test values(1);
insert into test values(2);

(select id from test
union all
select id from test
) order by id;


ID   
<http://localhost:8082/query.do?jsessionid=5f62325bda8f3e67587df6b85d4981de#>
1
1
2
2

select t1.* from (
(select id from test
union all
select id from test
) order by id
) t1;


ID   
<http://localhost:8082/query.do?jsessionid=5f62325bda8f3e67587df6b85d4981de#>
ROWNUM()   
<http://localhost:8082/query.do?jsessionid=5f62325bda8f3e67587df6b85d4981de#>
1 1
2 2
1 3
2 4

it looks like order is lost when adding a wrapping select.

is it a bug or expected behavior?

My goal is to do something like that:

select t1.* from (
(select id from test
union all
select id from test
) order by id
) t1 where rownum <3;

I know I should use LIMIT and OFFSET syntax but I would like to keep the 
Oracle syntax. 

thanks,
Boris.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to