Paul
unread,Apr 13, 2011, 3:38:02 AM4/13/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to H2 Database
Hello,
I currently have a very simple database and i seem to be running into
a problem that i believe might be a bug. I am using H2 version 1.3.151
(2011-02-12).
The table is set up as follows;
CREATE TABLE UserDetails (
ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY CONSTRAINT
UserDetails_PK PRIMARY KEY,
UID CHAR(32) NOT NULL,
Agent VARCHAR(200),
Number VARCHAR(30)
);
The database is then populated with arbitrary data with lots of
identical data in the agent column.
I have written multiple statements as follows;
SELECT * FROM USERDETAILS WHERE AGENT IN (SELECT TOP 2 AGENT FROM
USERDETAILS ORDER BY AGENT );
SELECT * FROM USERDETAILS WHERE AGENT NOT IN (SELECT TOP 2 AGENT FROM
USERDETAILS ORDER BY AGENT );
My problem is that i am not getting the expected results. When i
remove the "ORDER BY AGENT" from the subquery i get the expected
result. The first statement returns all the results from the table not
filtering out anything and the second statement returns absolutely
nothing.
At first my subquery statements were allot more complicated with GROUP
BY's etc but i simplified it to try and explain my situation.
I have run tests on SQL server just to confirm its not my stupidity
and all is well there.
Any input or feedback is appreciated.
Paul