怎样在java程序中查询数据库中时间字段中一个时间到另个时间(两个时间不确定)

2025-02-24 00:55:58
推荐回答(2个)
回答1:

{pStat= conn.prepareStatement("select Difficulty from test where type="+a[i]);
这句不对,这个只能查到一个。如下:
String example = "select Difficulty from test where type =" + a[0];
for (int i = 1; i < 50;i++) {
example = example + " or type =" +a[i];
}
PreparedStatement pStat = conn.prepareStatement(example);
rs = pStat.executeQuery();
for(int i = 0; i < 50;i++) {
Difficulty[i] = rs.getFloat(i);
}

回答2:

额~你到底要查出什么效果啊?是2个时间差,还是把2个时间当做区间连接起来?