这个问题非常奇怪,希望有人能帮忙解决,谢谢
String sql = "select max(process_length) from Process_condition where aggregate_name = 'S1 ' ";
String ok = db.executeMe(sql);
while(db.rs.next()){
length = Integer.parseInt(db.rs.getString( "process_length "));
System.out.println(length);
}
结果就报错了。。。
java.sql.SQLException: Invalid column name process_length.
at net.sourceforge.jtds.jdbc.JtdsResultSet.findColumn(JtdsResultSet.java:976)
at net.sourceforge.jtds.jdbc.JtdsResultSet.getString(JtdsResultSet.java:1217)
process_length字段类型是int,数据库驱动是jtds最新的(我也试过了jdbc驱动),都不行啊。。。麻烦各位了
------解决方案--------------------
--要给max()起别名为process_length
String sql = "select max(process_length) as process_length from Process_condition where aggregate_name = 'S1 ' ";