jdbc如何实现将第一次查询的结果集作为第二次查询的条件

如题。请教方法。另外自学java。方向Web 后台,没有系统的学习框架,求大神推荐合适的书籍

《Java开发实战经典》

子查询,在第一次查询的结果集外面包裹一层查询应该就可以了
select * from 表名 where (结果集条件)

1:你可以写存过,直接用游标。2就是JAVA中重新赋值。你可以上网搜下,还是比较简单的

select * from 表名 where (select * from 表名 where ***)大概也许可能这样吧

select * from 表名 where (select * from 表名 where 条件)

**select * from tablename where id in (select id from tablename where name like '%xxx%') and sex='male' **供您参考

select * from 表名 where (select * from 表名 where 条件)

select a.* from 表名 a where a.b = (select c.d from 表名 c where 条件)

如果是想通过JDBC的Java代码将上一次查询结果集当做下一次查询的条件,只能先把返回结果ResultSet值取出来然后再设置PreparedStatement中

select * from tb_user where pid in ( select id from tb_user where name like '%小张%')

可以进行Sql语句嵌套,将第一次查询的结果嵌套在where字句后面

select * from user_acount where uid in (select uid from user)

在循环里面套循环 while(rs.next())的时候,在里面重新再new一个ResultSet,然后把上一个rs的结果赋值给这个即可。

使用数据库子查询语句,select * from table where (select 。。。)

学习资料《Java面向对象编程(孙卫琴)第2版》
http://download.csdn.net/download/wanghaoqian/10208382

select *from tableName where (select *from tableName where conditon...)


推荐书籍是,java疯狂讲义。

可以前期先去网上 搜一搜相关教学视频

建应学springboot  ssm  这种框架