Hi All,
I have a question about "rownum" function work.
I have table "Keyword"
create table Keyword (
id bigint generated by default as identity,
text varchar(255) not null,
project_id bigint not null,
primary key (id),
unique (text, project_id)
);
id | text | project_id
---+------+-----------
1 | t1 | 8
2 | t6 | 4
3 | t2 | 6
4 | t9 | 2
5 | t0 | 1
6 | t4 | 7
7 | t3 | 2
for sql select
select * from KEYWORD where project_id = 2
I have
id | text | project_id
---+------+-----------
4 | t9 | 2
7 | t3 | 2
for sql select
select rownum,* from KEYWORD where project_id = 2
I have
ROWNUM() | id | text | project_id
---------+----+------+-----------
1 | 4 | t9 | 2
2 | 7 | t3 | 2
for sql select
select * from (select rownum,* from KEYWORD where project_id = 2) where id=7
I have
ROWNUM() | id | text | project_id
---------+----+------+-----------
1 | 7 | t3 | 2
But I expect to get
ROWNUM() | id | text | project_id
---------+----+------+-----------
2 | 7 | t3 | 2
ROWNUM() = 1 instead of 2
Is it right behaviour?
Thanks in advance,
Andrew
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.