2013-03-05 82 views
0

我曾經在oracle中寫過如下的類似查詢,並且當時有效。現在我試着把它放在Derby JDBC的prepareStatement中。語法就像「select field1,field2,field3 from A where(a,b)in(select a,b from B)」,在derby jdbc中支持?

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

沒有

 (THREADID,THREADID2) IN 

不工作

必須單獨像

 WHERE THREADID IN ('your condition') OR THREADID2 IN ('your condition') 
相關問題