我想搜索一列的最大值,但找到的值总是收到 0
public int maXnumR()
{
DataBase s = DataBase.getInstance();
int numR= getnumR();
String req1 = "SELECT max(`idrf`) FROM `reference` WHERE `numR` = "
+ numR + " GROUP BY `numR` ";
try
{
Statement m= s.getConn().createStatement();
ResultSet r1 = m.executeQuery(req1);
while (r1.next())
{
maxnumR =r1.getInt("idrf");
nbp++;
}
}
catch (SQLException e1)
{
e1.printStackTrace();
System.out.println("maXnumR : "+e1);
}
return maxnumR;
}
maXnumR 返回 0 并且表不为空。
如果我执行查询,它适用于 MySQL
错误:
java.sql.SQLException: Column 'idrf' not found.
maXnumR : java.sql.SQLException: Column 'idrf' not found.
idrf existe:0