2
如何从work_hours表中获取最后7条记录。如何获取最新的获取最近的7个条目
在这里你看到我自己的查询。这将会发生什么变化?
try{
String query="SELECT * FROM work_hours";
ResultSet rs =db.Select(query);
while(rs.next()){
//Retrieve by column name
int ID = rs.getInt("ID");
String Date=rs.getString("Date");
int Start_Time = rs.getInt("Start_Time");
int End_Time=rs.getInt("End_Time");
float Over_Time=rs.getFloat("Over_Time");
int Advance=rs.getInt("Advance");
int Other=rs.getInt("Other");
}
}catch(SQLException se){
se.printStackTrace();
}
你的查询产生了什么?一个错误?或错误的记录?通常我们在查询结束时使用限制7来设置我们想要的记录数。 –