select count(ta.code) from table1 ta,table2 tb
where ta.code=tb.code
where ta.code=tb.code
解决方案 »
- jsp 验证码怎样取值跟图片显示的值一样
- js怎么获取html中的元素
- |zyciis| 对于Antrl的StringTemplate中的判断语句怎么判断不为bool型的类型呢,谢谢 急
- 讨论下关于jsp中标签属性值的问题
- sqlserver 如何在到一定时间自动删除 一个过期的数据
- 如何用logic:iterate遍出来的集合放到html:select里?
- 为什么在WEB下就不能生成.txt文件??郁闷!!
- javascript自定义弹出对话框问题!!着急,在线等!!
- jsp中如何做oracle的备份与恢复?请各大虾帮忙。
- HashMap如何按value来排序?value不是整形的
- 哪位给个RESIN的完全教程(安装、配置.....)
- 我是jsp的新手,请问如何实现在页面中增加一个随着页面滚动的小页面????
int total=rs.getRow();
total 就是记录总数
int p=rs.getInt("num");
p就是总数
RS.next();
intRowCount=RS.getInt(1);
ResultSet rs = st.executeQuery("select * from table1");
rs.last();
int count = rs.getRow();
rs.beforeFirst();
while(rs.next())
{
...
}
Statement St = Conndefinedres.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet Rs = St.executeQuery(sql);
Rs.last();
int Rs_count = Rs.getRow();
Rs.first();//重新回到第一个记录;
方法二:
Statement St = Conndefinedres.createStatement();
ResultSet Rs = St.executeQuery(sql);
Rs.next();
int Rs_total=0;
for (Rs_total = 1; Rs.next(); Rs_total++);
// reset the cursor to the beginning
Rs.close();
Rs = St.executeQuery(sql);
Rs.next();
如果你的查詢你可以一個語句高定,那麼像上面幾位兄弟的方法就可以高定.
如果你的查詢很複雜,你可以先建視圖(View)來高定
pstmt = con.prepareStatement(SELECT count(*) FROM user_info);
ResultSet rs = pstmt.executeQuery();
if (rs.next()) {
count = rs.getInt(1);
}
这样就行了!
int i = 0;
while (rst.next()){
i++;
rst.next;
}