我曾经在oracle中编写了类似的查询,并且当时有效。现在我尝试将它放在Derby JDBC的prepareStatement中。
SELECT THREADID,THREADID2,SIMILARITY FROM S WHERE
(THREADID,THREADID2) IN
(
SELECT T1.ID,T2.ID FROM
(
( SELECT T.ID FROM T WHERE T.POSTTYPEID = '1' ORDER BY ANSWERCOUNT DESC FETCH FIRST 200 ROWS ONLY ) AS T1
JOIN
( SELECT T.ID FROM T WHERE T.POSTTYPEID = '1' ORDER BY ANSWERCOUNT DESC FETCH FIRST 200 ROWS ONLY ) AS T2
)
)
原来我得错了:
java.sql.SQLSyntaxErrorException:语法错误:在第1行第78列遇到“,”
我检查了代码,这个错误指向(THREADID,THREADID2)部分,它是否在JDBC Derby中不受支持?
答案 0 :(得分:0)
没有
(THREADID,THREADID2) IN
不工作
你必须像
一样分开 WHERE THREADID IN ('your condition') OR THREADID2 IN ('your condition')