結果セットは、次のような異なるデータ セットを返します。
> Winter 1001 112
> Summer 1001 112
> Autumn 1001 110
> Spring 1001 111
> Winter 1002 112
> Summer 1002 116
> Autumn 1002 110
> Spring 1002 115
> Winter 1003 112
> Autumn 1003 111
> Spring 1003 115
> Summer 1003 112
表示する必要があるデータは次の形式です。
[冬、夏、秋、春] [データ1] [112,112,110,111] [データ2] [112,116,110,115] [データ3][112,111,115,112]
私はコードを書いていましたが、これは私が持っているものです
if (connection != null) {
System.out.println("Got DB Connection!");
String selectTableSQL = sql;
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery(selectTableSQL);
while (rs.next()) {
caltList.add("\""+rs.getString(1)+"\"");
dataList.add(rs.getString(3));
}
}
String result = "";
String gotData = "I got data "
result = String.format(res,gotData,caltList,dataList);
誰かがハッシュマップまたはいくつかのアプローチでガイドできますか.. Javaが初めてで、さらに先に進むことができません