How can I get an Item from each Row?
For example, I have a column with the following Rows:
- TEST
- TEST
- TEST2
- TEST2
- TEST3
As I wanted:
- TEST
- TEST2
- TEST3
My code:
public void carregar(){
qy = "SELECT TESTEROWS FROM COLUNA";
try {
PreparedStatement ps = MySQL.getConn().prepareStatement(qy);
ResultSet rs = ps.executeQuery();
if (rs.next()){
setItem(TypeItem.valueOf(rs.getString("Type")));
}
loadItemsLoja();
} catch (SQLException e) {
e.printStackTrace();
}
}
With while it's only returning all (obvious), with if it only returns me the first one. How can I get one from each Row?