SQL: 如何给查询添加子查询

SQL: how to add a subquery to a query

我对我的 oracle 数据库有以下查询,其中包含两个单独的查询:

ResultSet rs2 = st2.executeQuery("select * from user_col_comments where  substr(table_name,1,3) !="+ "'TCT' and substr(table_name,1,4) != 'ARTZ' and (table in user_tables where secondary='N') ");

这在我的 Java jdbc 代码中编译正常。但是当我 运行 它时,我得到以下错误:

 java.sql.SQLSyntaxErrorException: ORA-00936: missing expression

我知道此查询的第二部分不起作用:

(table in user_tables where secondary='N')

我不明白为什么它不起作用,因为我是一个完全的新手。而且我不知道该怎么做。我检查了这个here。但我不认为它给了我想要的东西。我想结合这两个查询,以便我得到所有 user_col_comments 其 table 在 user_tables

那应该是一个子查询,例如

and table in (select table_name from user_tables where secondary='N')