Hi All,
 
           I have tried to execute below query then getting error as "Subquery 
is not a single column query; SQL statement: 
<http://10.135.116.190:8082/query.do?jsessionid=1379985327b8d05d6dcbf34f041d1a54#>".
 
When i execute same query on DB2..it is working fine. I have googled the 
error and found that H2 and Derby databases does not support this feature. 
Can any one have the solution/work around please share with me.

*Query:*

SELECT * FROM REPORTINFO  WHERE (REPORTINFOID , VERSION ) IN (SELECT 
REPORTINFOID , MAX(VERSION ) AS VERSION  FROM REPORTINFO  WHERE DELETED 
=FALSE GROUP BY REPORTINFOID )

*Error Details:*

Subquery is not a single column query; SQL statement:
SELECT * FROM REPORTINFO  WHERE (REPORTINFOID , VERSION ) IN (SELECT 
REPORTINFOID , MAX(VERSION ) AS VERSION  FROM REPORTINFO  WHERE DELETED 
=FALSE GROUP BY REPORTINFOID ) [90052-176] 
<http://10.135.116.190:8082/query.do?jsessionid=1379985327b8d05d6dcbf34f041d1a54#>
 90052/90052 (Help) 
<http://h2database.com/javadoc/org/h2/constant/ErrorCode.html#c90052>
org.h2.jdbc.JdbcSQLException: Subquery is not a single column query; SQL 
statement:
SELECT * FROM REPORTINFO  WHERE (REPORTINFOID , VERSION ) IN (SELECT 
REPORTINFOID , MAX(VERSION ) AS VERSION  FROM REPORTINFO  WHERE DELETED 
=FALSE GROUP BY REPORTINFOID ) [90052-176] 
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:344 
<http://h2database.com/html/source.html?file=org/h2/message/DbException.java&line=344&build=176>
) 
    at org.h2.message.DbException.get(DbException.java:178 
<http://h2database.com/html/source.html?file=org/h2/message/DbException.java&line=178&build=176>
) 
    at org.h2.message.DbException.get(DbException.java:154 
<http://h2database.com/html/source.html?file=org/h2/message/DbException.java&line=154&build=176>
) 
    at org.h2.message.DbException.get(DbException.java:143 
<http://h2database.com/html/source.html?file=org/h2/message/DbException.java&line=143&build=176>
) 
    at 
org.h2.expression.ConditionInSelect.optimize(ConditionInSelect.java:117 
<http://h2database.com/html/source.html?file=org/h2/expression/ConditionInSelect.java&line=117&build=176>
) 
    at org.h2.command.dml.Select.prepare(Select.java:834 
<http://h2database.com/html/source.html?file=org/h2/command/dml/Select.java&line=834&build=176>
) 
    at org.h2.command.Parser.prepareCommand(Parser.java:248 
<http://h2database.com/html/source.html?file=org/h2/command/Parser.java&line=248&build=176>
) 
    at org.h2.engine.Session.prepareLocal(Session.java:442 
<http://h2database.com/html/source.html?file=org/h2/engine/Session.java&line=442&build=176>
) 
    at org.h2.engine.Session.prepareCommand(Session.java:384 
<http://h2database.com/html/source.html?file=org/h2/engine/Session.java&line=384&build=176>
) 
    at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1188 
<http://h2database.com/html/source.html?file=org/h2/jdbc/JdbcConnection.java&line=1188&build=176>
) 
    at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:172 
<http://h2database.com/html/source.html?file=org/h2/jdbc/JdbcStatement.java&line=172&build=176>
) 
    at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:160 
<http://h2database.com/html/source.html?file=org/h2/jdbc/JdbcStatement.java&line=160&build=176>
) 
    at org.h2.server.web.WebApp.getResult(WebApp.java:1391 
<http://h2database.com/html/source.html?file=org/h2/server/web/WebApp.java&line=1391&build=176>
) 
    at org.h2.server.web.WebApp.query(WebApp.java:1064 
<http://h2database.com/html/source.html?file=org/h2/server/web/WebApp.java&line=1064&build=176>
) 
    at org.h2.server.web.WebApp$1.next(WebApp.java:1026 
<http://h2database.com/html/source.html?file=org/h2/server/web/WebApp.java&line=1026&build=176>
) 
    at org.h2.server.web.WebApp$1.next(WebApp.java:1013 
<http://h2database.com/html/source.html?file=org/h2/server/web/WebApp.java&line=1013&build=176>
) 
    at org.h2.server.web.WebThread.process(WebThread.java:168 
<http://h2database.com/html/source.html?file=org/h2/server/web/WebThread.java&line=168&build=176>
) 
    at org.h2.server.web.WebThread.run(WebThread.java:94 
<http://h2database.com/html/source.html?file=org/h2/server/web/WebThread.java&line=94&build=176>
) 
    at java.lang.Thread.run(Thread.java:745) 


-- 
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