Java中的executeQuery()可以运行嵌套查询吗?

问题描述 投票:0回答:1

jdbc中的executeQuery()可以运行嵌套查询吗?

Statement stmt = conn.createStatement();ResultSet rs = stmt.executeQuery(sql);

sql就像:

SELECT * FROM x WHERE
result IN (SELECT result FROM y WHERE cause = 'xyz')

抛出异常

java sql jdbc executequery
1个回答
0
投票

进行空检查

SELECT * FROM x WHERE
result IN (SELECT result FROM y WHERE cause = 'xyz' and result is not null)
© www.soinside.com 2019 - 2024. All rights reserved.