結果セットを格納するために Hashmap を使用しています。
HashMap<String,Integer> hMap = new HashMap<String,Integer>();
String existsUser = "select NAME" +" from Details where MEMID =" + memid;
rs = stmt.executeQuery(existsUser);
サンプルDBです
名前:ジャック・ジル・ジョン・ジャック
各名前の出現回数を個別に表示する必要があります。どうすればよいですか? 例: ジャック-2 、ジル -1
私は現在、このコードを持っています:
if(count == 0) {
hMap.put(rs.getString("NAME"),1); //get the string
}else {
hMap.put(rs.getString("NAME"),count +1);
}