今天使用JDBC遇到SQL关键字in的问题
String sql = "select sum(oil_mass),count(oil_id) from oil_bill where oil_id in (?) ";
...
PreparedStatement ps = conn.prepareStatement(sql);
ps.setString(stationIds);//11,12,13问题,一直出现在这里,只包含一个。
...
目前使用的解决方案拼接到sql中
String sql = "select sum(oil_mass),count(oil_id) from oil_bill where oil_id in ("+stationIds+") ";